Code Comments
Programming Forum and web based access to our favorite programming groups.I'm pulling my hair out over trying to get a socket passed from one process to another. My latest problem is in getting the receiving process to detect the incoming socket. I'm using select() as I do with all the socket descriptors and pipe descriptors, but it just times out, as though the socket was never sent. If I create a set of descriptors using socketpair(AF_UNIX, SOL_SOCKET, 0, desAncils), does select() treat those descriptors the same as those created with pipe(), accept() or connect()?
Post Follow-up to this messageJo wrote: > I'm pulling my hair out over trying to get a socket passed from one > process to another. My latest problem is in getting the receiving > process to detect the incoming socket. I'm using select() as I do with > all the socket descriptors and pipe descriptors, but it just times > out, as though the socket was never sent. If I create a set of > descriptors using socketpair(AF_UNIX, SOL_SOCKET, 0, desAncils), does > select() treat those descriptors the same as those created with > pipe(), accept() or connect()? The second parameter to socketpair is wrong. You should be passing a socket type (e.g. SOCK_STREAM, SOCK_DGRAM, etc.). -- Andrew
Post Follow-up to this message> I'm using select() as I do with all the socket descriptors and pipe > descriptors, but it just times out, as though the socket was never > sent. It is almost certainly a bug in your code. Did you remember to set the first argument to select() to be the value of your largest file descriptor PLUS one? Did you remember to re-initialize your file descriptor masks before EVERY call to select()? > If I create a set of descriptors using socketpair(AF_UNIX, > SOL_SOCKET, 0, desAncils), does select() treat those descriptors the > same as those created with pipe(), accept() or connect()? Yes. Or open(). Or the 0, 1, and 2 descriptors automatically created for you. As far as select() is concerned, a file descriptor is a file descriptor is a file descriptor. You can select() on all of them. b
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.