C Board  

Go Back   C Board > General Programming Boards > Networking/Device Communication

Reply
 
LinkBack Thread Tools Display Modes
Old 03-22-2004, 06:23 PM   #1
Registered User
 
Join Date: Mar 2004
Posts: 13
recv()

I am writing client program, using sockets. The client also has to accept responses.

I connect to the server ok, can send requests ok. The problem is when I try to recv().

The main program deals with the send()ing stuff, I have fork()ed a new process to sit and recv() responses from the server.

The program breaks after it has recieved one responce. I am using the same file descriptor for both send() and recv(), could this be the problem?

The error message is:
recv: Connection reset by peer

Any help would be appreciated,
Cheers
afisher is offline   Reply With Quote
Old 03-22-2004, 06:28 PM   #2
C++ Developer
 
XSquared's Avatar
 
Join Date: Jun 2002
Location: UWaterloo
Posts: 2,718
Most of us aren't telepathic (not sure about Prelude and Salem), so it would help if you showed some code.
__________________
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
XSquared is offline   Reply With Quote
Old 03-23-2004, 05:49 AM   #3
B26354
 
Deckard's Avatar
 
Join Date: Jan 2002
Posts: 631
Based on the information you've provided, it appears the server is disconnecting from you after sending the response (much like an HTTP server).
__________________
Jason Deckard
Deckard is offline   Reply With Quote
Old 03-24-2004, 05:32 PM   #4
End Of Line
 
Hammer's Avatar
 
Join Date: Apr 2002
Posts: 6,240
@afisher: Are we talking about a web server here?

Assuming we are...

>>The program breaks after it has recieved one responce.
What was the response? If it was a good response (eg a web page), then your connection is possibly being closed because you didn't set the http keep-alive header. If it was a bad response, or simply no data at all, then your request was probably bad in the first place.
__________________
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
Hammer is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
recv() returns 0 the second time Overlord Networking/Device Communication 7 07-10-2009 04:09 AM
Question about recv carrotcake1029 Networking/Device Communication 2 02-26-2009 02:10 PM
recv() problem Massive C Programming 5 06-26-2003 04:58 AM
non blocking recv rohit Linux Programming 4 03-05-2002 09:35 PM
recv function (blocking) aurumice Linux Programming 0 03-01-2002 01:19 AM


All times are GMT -6. The time now is 09:34 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22