[Q] Socket - what is the "backlog" setting for?

Chris Muller afunkyobject at yahoo.com
Tue Jun 4 16:48:28 UTC 2002


I thought it was to ensure data sent to the server while it was busy did not
get dropped.  But after a week of diagnosis, I have finally narrowed down a
problem in my network program that occurs when the "client" machine happens to
be a faster machine than the server.  This caused a timing events to happen
like this:

  1. server is listening for a connection.
  2. client connects a new socket to the server.
  3. server accepts.
  4. client immediately sends a small amount of data.
  5. client waits for a response (i.e., via dataAvailable).
  6. server begins its wait to receive data, which was already sent in step 4!

Both machines are waiting on the other.  But the server dropped the ball in
this case.

In my server program, there is almost no code between the accept and the
receive, but the client in this case was still too fast.  When a brief delay
was introduced in the client right after making the connection, it worked!

Obviously, I hate to have to put arbitrary delays in my client code.  Is there
a better alternative?

Thanks!


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the Squeak-dev mailing list