Hello...!
I have written a programme using sockets ( Server-Client model) and while i am running the prorgamme it prints "Broken pipe"
Do you know why i have that..? ANy recommedations?
Thx you!!!
Hello...!
I have written a programme using sockets ( Server-Client model) and while i am running the prorgamme it prints "Broken pipe"
Do you know why i have that..? ANy recommedations?
Thx you!!!
Let me google that for you
That'll tell you why it's happening. Meanwhile, post the code so we can look at it?
This usually means something you were connected to broke the connection. For example, if you connect to a web server, make a request, receive the data, and then fail to disconnect, you may get a broken pipe, because web servers do not maintain persistent connections: they accept(), process a request, then close() the connection immediately.
Needless to say, if a process dies, all it's connections are automatically closed.
A broken pipe will not produce an error until you try to send() or recv(), but it is an immediate problem that may cause the underlying socket layer to go into overdrive and max the processor out. In other words, it is a serious potential problem with persistent connections that you need to deal with. The way I usually do this is to use a glib function, g_io_add_watch.
IO Channels
However, probably you do not want to bother with that as glib is (usually) available only on linux systems.
I think select() will also help detect this problem right away.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge