Re: Non-blocking Accept in C

From: Kendall Lister (kendall@charon.net.au)
Date: Wed Jan 12 2000 - 17:15:03 EST


On Wed, 12 Jan 2000, Larry Griffin wrote:

> This particular server side only is looking for one client so I go
> into a loop that checks, sleeps for a half second or so and checks
> again. I'm trying to get the server to account for link outages or
> other failures. It had code in there to set reuse but I commented it
> out while working on this other problem.

When you say you are delaying between checks, are you doing this:

while (TRUE) {
  select(n, &readfds, NULL, NULL, 0.5);
}

or

while (TRUE) {
  select(n, &readfds, NULL, NULL, 0);
  sleep 0.5;
}

If you use the second alogorithm, you'll probably never register a
connection.

> Right now I've set up a simple client and server just to trouble shoot
> the problem. Maybe I need to upgrade my release. This is RedHat
> 2.0.36.

Well, I'm using 2.0.38, and I've just written a tiny HTTP interface for a
daemon, based on about an hour of reading up on sockets - so my advice may
not be the best you can get... :)

--
 Kendall Lister, Systems Operator for Charon I.S. - kendall@charon.net.au
  Charon Information Services - Friendly, Cheap Melbourne ISP: 9589 7781

- To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.rutgers.edu



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:29 EST