understanding stream.php and zms

Forum for questions and support relating to the 1.25.x releases only.
Locked
carteriii
Posts: 65
Joined: Sun Oct 28, 2007 3:13 pm

understanding stream.php and zms

Post by carteriii »

I'd like to ask the developer gods among us for help in understanding the interaction between the stream.php web source file and zms. I ask because although my zoneminder system has generally been running fine for about 7 years, I now am unable to view streaming events and instead see the error:

Code: Select all

socket_sendto( /tmp/zms-034547s.sock ) failed: No such file or directory
Sadly, there are many, many other posts where other people have received the same error. I think I've read most all of those threads and tried most everything suggested like removing the trailing slash on the ScriptAlias for /cgi-bin/. Although very few of the posts mention it, this is presumably to be able to properly run zms. For what it's worth, my /tmp directory is rwx by everyone, and my PATH_ZMS is set to /cgi-bin/zms. I don't know exactly when my problem started, so perhaps I made some other change to apache that is causing this, so I'm trying to be good and document/debug some of this for everyone else.

I've traced the specific error message to the socket_sendto() call within the ajax/stream.php file, and I've been reading the php documentation on the socket functions (e.g. http://www.php.net/manual/en/function.socket-sendto.php) but I don't understand how that is supposed to work. The core doc and examples given only use IP addresses for the $addr parameter, so I'm struggling with how the filename is supposed to work when using a socket.

I am also confused as to why the socket_bind call earlier in stream.php uses the $locSockFile filename with a suffix of "w.sock" while the socket_sendto call uses the $remSockFile filename with the "s.sock" suffix. Does "loc" in $locSockFile stand for "local" while "rem" in $remSockFile stand for "remote"? If so, which component or process is considered the local one and which is considered the remote one?

There is code in stream.php which checks for the existence of the $remSockFile, and even tries three times with a comment, "//sometimes we are too fast for our own good, if it hasn't been setup yet give it a second". But as far as I can see, the $remSockFile with the "s.sock" suffix name isn't referenced anywhere else. So how else would that file be created? Would zms have already been called with the same $_REQUEST['connkey'] to create it?

This is where I need help understanding zms. How/When/From where is that called? Is zms supposed to create the $remSockFile file? What is the general sequence of events that should occur for the $remSockFile to properly exist?

I also do realize that the code execution is slightly different when cambozola.jar is used versus a browser like Firefox that natively supports the jpeg display, but I'm struggling to understand whether that's even relevant to this problem.

Hopefully you can see that I'm trying to dig into this to solve the problem for myself, but I need some more information. If we can use this thread to educate everyone, hopefully we'll reduce the number of people in the future that get the socket_sendto failure and have no idea how to start debugging, other than trying semi-random suggestions that they read in other posts.
Locked