1. Socket broken pipe error
Hi, in a typical echo server program, I used two buffers, namely
char received[BUFSIZ] and char replied[BUFSIZ],
to read from and write to a stream socket respectively. Everything was
fine until I closed the socket gracefully in the client program. The
server caught this "broken pipe" error message due to a negative read()
from the closed socket.
There shouldn't be problem with the client as it worked well with another
echo server problem.
Then I commented out the statement
"memset(replied, 0, sizeof(replied))"
which used to appear before each write to the socket in that problematic
server program. This seems to rectify the situation as read() returns
0 in the server as expected whenever I quit the client and the error
Later I found that the "bzero(replied, sizeof(replied))" also caused
similar "broken pipe" message to the server.
It seems quite strange to me that upon the closure of a socket by the
client, a mere memset()/bzero() caused the server reading a socket to
return a negative value instead of 0.
Has anyone come across similar similar situation? I couldn't find any
special mention about memset() and bzero() in this regard.
2. Help for a 15 year old!
3. What does socket error "broken pipe" mean?
5. net: eof!(write) socket 5 (Broken pipe,32)
6. Installing New Libraries
7. C++ sockets on unix, problems with broken pipe
8. Over 64MB Memory????
9. 'broken pipe' with sockets
10. Socket operations failing with "Broken Pipe"
11. error with apache on RH - (32)Broken pipe: accept: (client socket)
12. Question on knowing when a pipe connection breaks
13. TCP/IP broken socket question