LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 08-17-2007, 02:31 AM   #1
yugandhar
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, 10:03 AM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Let the client confirm reception of data through the protocol that you use.
E.g.
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 10:06 AM.
 
  


Reply



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 03:54 PM
LDAP SERVER Client Connection on SUSE 9.2 - connection error jcarton Linux - Networking 3 03-19-2005 12:40 PM
LDAP SERVER - CLIENT CONNECTION on suse 9.2 - connection error nicolasdiogo Linux - Networking 4 03-01-2005 01:43 PM
LDAP SERVER - CLIENT CONNECTION on suse 9.2 - connection error nicolasdiogo SUSE / openSUSE 0 03-01-2005 05:43 AM
problems with established connection nbc Linux - Newbie 1 08-16-2001 01:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:07 PM.

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