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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top