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,
Most of us aren't telepathic (not sure about Prelude and Salem), so it would help if you showed some code.
Based on the information you've provided, it appears the server is disconnecting from you after sending the response (much like an HTTP server).
@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.