Python Forum

Full Version: Checking connectivity for sockets in Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to check the connection between my client and server ie. should know as soon as the connection is cut off. I tried settimeout( ) but it gave "timed_out" message whenever the application in my client was idle. Any ideas on what function I can use here??? Sad
In TCP/IP there is no "connection" (in the sense of a permanent link...). You cannot tell that there is no path between the client and the server unless the client tries to access the server. This is usually done with a "heartbeat" routine, that does a regular trivial request to the server. But the heartbeat can report very temporary losses of contact that the client wouldn't notice.