RE: accept

Richard B. Johnson (root@chaos.analogic.com)
Mon, 5 Feb 2001 07:59:59 -0500 (EST)


On Sun, 4 Feb 2001, Mathieu Dube wrote:

> Ok, but fd 0 cant be a valid socket since its the stdin
>
Sure it can:

close(0);
close(1);
close(2);
fd = socket(....);
dup....etc, for stdout and stderr.

That said, never, never, ever, check the value of the errno global
unless a function call returned an error. Many/most/all C runtime
procedures don't touch that variable unless an error occurred.
So, reading its value will show the results of something that
happened hours ago (line an interrupted system call).

> I posted that on this mailing list coz I thought that this might be a scaling
> problem since it happens when theres already several clients connected to the
> server

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/