Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Winsock and dropped connections.

Posted on 2000-03-15
4
Medium Priority
?
236 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 400 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

916 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