Unable to detect socket connection lost problem

  • Thread starter Thread starter Arsalan Ahmad
  • Start date Start date
A

Arsalan Ahmad

Hi,

I have written two applications:

1. Client written in MFC and VC++ 6.0
2. Server written in C#

These two applications communicate each other via socket. The problem is if
I close the client application (during which I also call CSocket::Close())
method as well. But my server is unable to detect whether the client is
closed now or not? Any hint how to implement this. I don't want to use any
PING PONG technique here.

Thanks,

Arsalan Ahmad
 
Supposedly this is a problem with most socket based programs. Normally
you receive a data packet of 0 which indicates that the socket has been
closed. However this is not always accurate. Afraid to say that if you are
looking for something reliable a Ping Pong method is going to be your best
bet. because if for some reason the connection is dropped and either parties
are not made aware of it then the only time you become aware of it is when
an attempt to read or write data to the socket is made.

Hope that helps
 
Back
Top