Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 08-17-2007, 03:31 AM   #1
LQ Newbie
Registered: Jun 2006
Posts: 28

Rep: Reputation: 15
How can server find whether the connection established with client is alive

Hi all,
I have one server application which is compiled on linux and it is running fine and my client application is also working fine. My problem is that when the client comes down or client closes the connection how can my server program come know that the connections with the client is not alive.
When i am sending large data through the network to client it is not get read by client at this point i want to know from server program whether the client is alive or not. How can i do this. Any suggestions.
Old 08-17-2007, 11:03 AM   #2
Wim Sturkenboom
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Let the client confirm reception of data through the protocol that you use.
client requests file
server sends first 1000 bytes
server waits for acknowlege
server sends second 1000 bytes
server waits for acknowlege
etc etc

Further, when a client disconnects nicely, the socket at the server side will indicate that there is data received but reading it will return 0 bytes. You might also get some sigpipe errors that you have to catch (not 100% sure, but probably when you try to write over a closed socket).

FYI, there is a dedicated programming forum

Last edited by Wim Sturkenboom; 08-17-2007 at 11:06 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Time out in Connection established state if no Data flows on that connection asurya Linux - Networking 2 04-10-2005 04:54 PM
LDAP SERVER Client Connection on SUSE 9.2 - connection error jcarton Linux - Networking 3 03-19-2005 01:40 PM
LDAP SERVER - CLIENT CONNECTION on suse 9.2 - connection error nicolasdiogo Linux - Networking 4 03-01-2005 02:43 PM
LDAP SERVER - CLIENT CONNECTION on suse 9.2 - connection error nicolasdiogo SUSE / openSUSE 0 03-01-2005 06:43 AM
problems with established connection nbc Linux - Newbie 1 08-16-2001 02:11 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration