[ee122] accept() blocks too much...

Richard Schmidt huntingtonsurfca at gmail.com
Thu Sep 20 16:32:47 PDT 2007


I'm running select() and the listening port is returning that it's ready to
add a new connection, but then it'll say it's ready even though there are no
pending connections, thus blocking any interactions with current clients
until someone else connects. I'm copying over the read_set each time before
select() is called (ala Beej) so I don't think it has to do with old data in
the read_set.

Any ideas? I thought maybe accept() should have a timeout too (since select
does), but ti doesn't seem to be working that way...
Accept works, and if I connect another client, it then is able to process
the previous clients request/respond to it. So I know the code is fine it's
just a conceptual thing about accept() and why the listening port is saying
that it's ready even though there's no pending conenctions.

I tried me server on sphere.cs (fyi).
I tried connecting to it using (functioning properly) http_client localhost
<listening port>.

When I sent data out from first client it doesn't reply (even thoughit was
sent w no errors).
Server is hung on accept()
I connect another client (new ssh).
Server gets new connection.
Server handles first client's request, and sends a reply.
server thinks the listening port is ready again so it accept() blocks.
Have to make a new connection.
Server gets connection.
...
...
...

Thanks in advance,
Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/ee122/attachments/20070920/933ed953/attachment.html 


More information about the ee122 mailing list