10-30-07 12:22 AM
hg@x-formation.com wrote:
> I'm doing some experimental work on linux (x86, 2.6 kernel) with a
There have been 23 versions of the 2.6 kernel thusfar, so it would be
good to state which specific one you are using. The output of uname
-a would suffice for that purpose.
> tcp server. What I have is a typical select() call which is suppose
> to tell me when a socket is readble. This must happen for both
> listen socket to accept new connections and the normal sockets. All
> of the connections including the listen socket are set non- blocking
> and furthermore socket re-use flag is specified for the listen
> socket.
I presume you mean SO_REUSEADDR, which will allow a socket to be bound
to port numbers for which there are already TCP endpoints in states
other than LISTEN. That is not the same thing as socket reuse, which
if it were present under linux would be the actual reuse of socket
datastructures, probably not unlike the TCP connection caching of
HP-UX 11 and perhaps other platforms. (Which in and of itself is
somewhat poorly named since it isn't the "connection" cached as much
as the stack of Streams modules which carry the state of a
connection).
> However I experience that with the listen socket it ALWAYS returns as
> readable regardless of if any clients are connecting or not.
> I'm using both ipv4 and ipv6 on each their socket and what I see is
> that the ipv4 socket always returns as readable.
> What am I missing here? The linux man page for accept says something
> else.
> I should note that this code is ported from Windows where it worked
> perfectly fine without any changes.
In the land of Unix/Linux, something working under Windows is rarely a
ringing endorsement
> I've ensured that highest socket number + 1 is passed to select.
> Before this it wouldn't even return at all.
Start taking strace traces of your application and that will likely
help you determine what is going-on. It will help make certain that
your select() calls are being given what you think they are being
given and show you what they are returning.
rick jones
--
firebug n, the idiot who tosses a lit cigarette out his car window
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
[ Post a follow-up to this message ]
|