Solved

Winsock and dropped connections.

Posted on 2000-03-15
4
207 Views
Last Modified: 2010-04-10
How can my client application detect that the connection to a server device is gone/lost, 'network cable is removed', before i send data with the send function?

0
Comment
Question by:Wolfie320
  • 3
4 Comments
 

Expert Comment

by:benny_czarny
ID: 2621663
I suppose it is a tcp connection ?

and regular sockets ( not a class )
? under NT ?
visual c++ ?

 
0
 
LVL 3

Accepted Solution

by:
ufolk123 earned 100 total points
ID: 2622107
Hi Wolfie320,

In standard socket interface it is not possible to find out the physical connection link breakup as TCP is a logical link so even if physical link is dissconnected and re-established quickly there should be no -problem for a slow user applicaiton.
Actually the physical link down can only be found probably after next call as send() does not check for any physical transfer .it just puts the data in local buffers and return.Only thing here which helps to detect physical connection to some extent is SO_KEEPALIVE option.Please check the man pages for setsockopt() for this.This will probe the link by sending regular packets over the network event when there is no actual data transfer so you you will be able to detect the network down problem.
Or in other case,You will only know when TCP really transfers the data, this may happen after your send and may be 3-4 more send after that .There is no way to force TCP to flush data across the net to identify this problem.

If you have specific doubts please get back.
0
 

Expert Comment

by:benny_czarny
ID: 2622126
the tcp stack sends a keep alive packet from time to time
you can control that via sessionKeepalive registry param
to increase resolution you'ld probably need to decrease the keep alive intervals

0
 

Expert Comment

by:benny_czarny
ID: 2622129
opps I did not see your comment
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now