Broken Pipe Error.

Posted on 2003-12-07
Last Modified: 2011-08-18
in my program,i am using different pthreads,and trying to connect to some servers ,recivining and sending data,i am getting Broken Pipe error, and program exiting,
some body said,it is problem of writing 2 times in a non connected socket,i am cheking the error at all writing,and if error occurs i am just closing the socket,and exiting,
but still the same problem broken pipe coming,
wat may  be the acutal problem
expecting ur helps
Question by:hirosh
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 45

Expert Comment

ID: 9894501
Hi Hirosh,

Most likely cause is writing to a pipe which has no reader ... this may be because of the fact that you have not yet programmed a thread/process to read from the pipe or that pipe reader might have exited ...

Author Comment

ID: 9894509
i am not using the pipe,just using only the socket,connect,recv,send i mean the client parts on pthread

Author Comment

ID: 9894840
i think i am getting broken pipe error,when i am trying to send some long data,when i commented that sending long data,it is working i think,but wat the way way to overcome this
Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

LVL 45

Expert Comment

ID: 9894902
one work around is to fragment data before sending and assemble it at client site

post the code if possible

Accepted Solution

mtmike earned 250 total points
ID: 9897291
The kernel will send the SIGPIPE signal when the remote end closes or shuts down the socket and you try to send/write. The default signal handler will terminate your program.

One solution is to ignore the signal using 'signal(SIGPIPE, SIG_IGN)' somewhere at the start of your program. You will get an EPIPE error return when send/write fails due to a broken pipe.

Another less portable solution is to pass the MSG_NOSIGNAL flag to send(). This has the same effect.

Author Comment

ID: 9934118
thanks mtmike ,it is the problem,lots of thanks man
and thanks for sunnycoder too,

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question