(rafi - your quoting mixes your text with mine - you might want to fix this - it was very hard to read your letter).

see my comments below:

Rafi Cohen wrote:
Hi Guy


Rafi Cohen wrote:

So, I have a couple of questions and I'll most apreciate any assistance. 1. Would you confirm that select, indeed, does not detect each and every remote disconnection and do you know if there is a rule

behind those cases?

TCP/IP stacks on linux, by default, will only notice a network disconnection (i.e. the network went down) "reliably" after 2 hours. that's how TCP/IP's internal keep alive mechanism is set. 2 hours is a completely impractical value for any sane system you might develop.

you can tweak this parameter of the TCP/IP stack for specific sockets,
on current linux kernels, using a socket option. (man 7 tcp - and look for 'keepalive' - there are 3 parameters for this). i never used this mechanism, since it was only possible to make this change globally when i needed that.
>
> and rafi responds:
>
I know of this option and will look into that deeper. May be I miss here
something, but this option may be relevant for the case my application
is a server. I wonder how it would affect, if at all, when my
application is a client.

it does not matter if you have a client or a server - you want to know about network problems either way - unless you assume that the client is a GUI and the user will simply hit the 'cancel' button. since in your case it does not appear to be a GUI - rather a longer-living server, then you might want to handle the disconnection issues both on your side, and on the side of the server.

note that for some applications, it is enough to have a 'close the socket if it was idle for X time' - i.e. if you didn't get any data from a socket during X minutes - you close it.

Thanks, Rafi.

hope this makes it clearer.

--guy


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to