"Dan N" <(E-Mail Removed)> wrote in message
news

(E-Mail Removed) ldomain...
> I have a server application with a tcp socket listening for incoming
> connections. The client application is on a tablet that connects to the
> network via wifi. Assume that the client opens a connection to the
> server and then is taken out of range.
Okay.
> The server then writes some data to the socket. The tcp-ip stack will
> repeatedly send the data packet to the client, hoping to get a tcp ack
> back.
Correct.
> How long will it resend the packet before it abandons the process?
Until it makes the determination that communication is impossible.
> I know that it resends at increasingly longer intervals, but how long are
> those intervals?
The application should not depend upon the intervals being any
particular value. The stack will tell you when it has given up.
> What I'm aiming to accomplish is seamless communications between the
> client and the server. The tablet could be out of range for quite some
> time. When it comes back into range, I want to make sure that it gets
> its data. At what point does the server application have to consider
> session invalid and perform remedial action?
When the TCP/IP stack says the connection has broken. Just make sure
that both sides periodically send some data or one side sends data and the
other side times out. This will guarantee you timely detection of
communication failure. When a TCP link breaks, you can try to re-establish
the link by creating a new link.
You have to do the following things:
1) Ensure timely detection of link loss. This means that each side has
to be either sending data or waiting a finite amount of time before it sends
data or times out.
2) Attempt to re-estalibish a broken connection. That is, once you get a
report from the stack that the connection has broken, one end (at least)
must attempt to re-establish a connection.
3) Resume context once a new connection is made. This depends upon
exactly what you're doing, but you need to figure out where you were and
keep going once the new TCP connection is operational.
DS