471,311 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,311 software developers and data experts.

Socket.Send Exception Delay

i am trying to build a "missed message" queue on a C# TCP server. many
of the devices connecting are mobile and may drop out in bad signal
areas. i want to store any messages missed for when they reconnect.

so far....it takes activity on the client end to initialize the close.
isnt there a check when the server sends a socket.send to a client that
has lost connection? it takes a few minutes for the exception to get
hit, and i am losing vital time.

is there a way for as soon as the the server attempts Socket.Send it
can tell if the device on the other end still has an active connection?

even Socket.Poll() has quite a delay.

i have been testing with desktops. I connect two workstations to the
server and when i chat back and forth, i unplug one from the network.
it takes at least two minutes for the server to recognize that one
client is disconnected while the still-connected client is sending
messages. it seems they are just going nowhere.

Feb 10 '06 #1
1 2534
CKane wrote:
so far....it takes activity on the client end to initialize the close.
isnt there a check when the server sends a socket.send to a client
that has lost connection? it takes a few minutes for the exception to
get hit, and i am losing vital time.
[...]
i have been testing with desktops. I connect two workstations to the
server and when i chat back and forth, i unplug one from the network.
it takes at least two minutes for the server to recognize that one
client is disconnected while the still-connected client is sending
messages. it seems they are just going nowhere.


Hi CKane. This is an inherent issue with the TCP protocol, and perhaps
transport protocols in general - it is able to maintain a session, but if
one client just "drops out" with no close message, it is impossible to
distinguish this from a temporary spike in latency or other network
problems. Your best bet is to set up some kind of application-level "ping"
message that is sent periodically between the client and server to
continually verify that the client is present - if you receive no response
for a certain number of pings, you can use this to guess that the client has
dropped. Just ensure that if they didn't drop after all that nothing
terrible happens and you can recover. I hope this helps.
--
Derrick Coetzee, MCAD, MSFT (Speech Server)
This posting is provided "AS IS" with no warranties, and confers no
rights.
Feb 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Daniel | last post: by
4 posts views Thread by DreJoh | last post: by
3 posts views Thread by Robert A. van Ginkel | last post: by
2 posts views Thread by Nuno Magalhaes | last post: by
2 posts views Thread by manasap | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.