G
Guest
Hi All,
I am developing a Client / Server App using Visual Studio 2003 and a Smart
Device App and a TCP/IP Socket connection.
I have discovered a major flaw in the Winsock2 implementation in .Net
framework that I have no work around for.
The issue is there are no events or work arounds (that work) for capturing
when a client socket goes away. The issue is also inherent in the server
side also for sending data. You don't know the socket has closed server side
until an attempt to send is made. The server problem is not that much of an
issue just annoying, as the client maintains the connection on our CDMA/GPRS
networks. With data being at a premium for this service, sending heartbeats
at short intervals for over 200 devices gets very expensive. If the socket
was to alert the client app when it is closed the client can then reconnect
and maintain a reliable efficient connection for message delivery.
Suggested work around (Does not work)
Using the asycronous callback for begin receive (which I alread was), if
you fail to receive data in the callback function, the socket has most likely
gone away and you should test for reconnection. Unfortunately the callback
function is not called with 0 bytes received so there is no way to know the
connection has been dropped.
Does anyone have another work around that they have tested or is this a wait
until next version of winsock issue and hope something else has not been ?
This seams to me to be a fundamental flaw in the .net framework
implementation of winsock2 and one you would definately hope gets fixed asap.
Any help anyone could provide would be much appreciated.
Thanks,
Glen.
I am developing a Client / Server App using Visual Studio 2003 and a Smart
Device App and a TCP/IP Socket connection.
I have discovered a major flaw in the Winsock2 implementation in .Net
framework that I have no work around for.
The issue is there are no events or work arounds (that work) for capturing
when a client socket goes away. The issue is also inherent in the server
side also for sending data. You don't know the socket has closed server side
until an attempt to send is made. The server problem is not that much of an
issue just annoying, as the client maintains the connection on our CDMA/GPRS
networks. With data being at a premium for this service, sending heartbeats
at short intervals for over 200 devices gets very expensive. If the socket
was to alert the client app when it is closed the client can then reconnect
and maintain a reliable efficient connection for message delivery.
Suggested work around (Does not work)
Using the asycronous callback for begin receive (which I alread was), if
you fail to receive data in the callback function, the socket has most likely
gone away and you should test for reconnection. Unfortunately the callback
function is not called with 0 bytes received so there is no way to know the
connection has been dropped.
Does anyone have another work around that they have tested or is this a wait
until next version of winsock issue and hope something else has not been ?
This seams to me to be a fundamental flaw in the .net framework
implementation of winsock2 and one you would definately hope gets fixed asap.
Any help anyone could provide would be much appreciated.
Thanks,
Glen.