Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Linux


Programming :: Handle A Broken Pipe Exception (SIGPIPE) In FIFO Pipe?

I've written a simple server in linux used fork to create a FIFO pipe.The server create two FIFO pipe.One for server read data from client and write data to client.Then another pipe for client read data from server and write data to server.When the server read data from a client used server-pipe and then write data to client.But ,if the client no read open the pipe,the server side write will be crashed because of a broken-pipe SIGPIPE. How to check whether the read side is opened?Or,how to catch the SIGPIPE,and then my server will still execute on,not crashed!!

View 5 Replies (Posted: 03-02-2011, 11:24 PM)

Sponsored Links:

Related Forum Messages For Linux category:
General :: What Is Meaning That File Is Named Pipe (FIFO)?
What is a pipe? and why a file is a named pipe? I am just learning linux.

Posted: 07-12-2011, 04:02 AM

View 2 Replies!   View Related
Programming :: Python Script Gives Error - Broken Pipe
I am building a python script which works same as SMTP protocol. I have build separate functions in that for each command of SMTP, and after this i have integrated all those functions in a new function named as send_mail(so that i don't have to execute every function separately for every command). Now, when i execute the script for the first time it runs successfully, but for the second time it gives the error of "BROKEN PIPE". I really can't make out how the socket is getting closed.

Posted: 07-21-2011, 05:53 AM

View 5 Replies!   View Related
Networking :: PING - Pipe 2 Versus Pipe 3
I'm doing ping between 2 RH servers through a VPN site2site tunnel and in some times I got in the result pipe 2 and another pipe 3 as I mark it in blue color below.


64 bytes from icmp_seq=0 ttl=128 time=0.229 ms
64 bytes from icmp_seq=1 ttl=128 time=0.287 ms
64 bytes from icmp_seq=2 ttl=128 time=0.278 ms


What's the difference between pipe 2 and pipe 3 and what's the meaning of it?

Posted: 04-10-2009, 06:06 AM

View 1 Replies!   View Related
Server :: Pipe 'echo' To 'netcat' - Sometime It Seems To Broken
I am running somes instances of Redis. I want to get Redis stats with following command:


$ echo "info" | nc <server_IP> <port>

but sometime it returns nothing. The first thing come to my mind is broken pipe or something like this. I always get the result if telnet to Redis and typing 'info' command. I also try pipe viewer to monitor the progress of data but it didn't help:


$ echo "info" | pv | nc <server_IP> <port>

Posted: 09-02-2010, 10:31 PM

View 2 Replies!   View Related
Networking :: Error - Broken Pipe
We are facing broken pipe exception while connecting to SMPP gateway through TCP/IP.on RHEL4 It is coming till we restart the application. Below is the exception we are getting. Broken pipe

Posted: 07-15-2010, 02:37 AM

View 1 Replies!   View Related
Server :: Error: Write Failed: Broken Pipe
I connect to our server by ssh, default ssh client on Debian system.when I run a command that has large output on stdout (on shell) my connection is lost and I get error: "Write failed: Broken pipe"Unfortunate on our server there is limitation for connection per hour!

Posted: 04-11-2010, 06:25 AM

View 2 Replies!   View Related
Fedora Networking :: Net Worked HP Printer Will Not Print-broken Pipe
my net worked HP printer will not print-broken pipe - this started after I had to switch off the printer at the mains in order to attend to a paper jam. Now it will not print apart from a test page. I am using Fedora 10 and the device info is "hp:/net/Officejet_Pro_L7500?ip="

Posted: 10th April 2009, 10:56 PM

View 5 Replies!   View Related
Server :: Apache2 EnableSendfile And Error - Broken Pipe: Core_output_filter
I have installed a LAMP server (Debian Lenny + Apache2 + PHP Version 5.3.1-0.dotdeb.1). On this machine, my web application (PHP + MySQL) exists in 2 flavours:

- Dev
- Prod

In /etc/apache2/sites-available, I have ims & ims-dev, one for each instance. Their contents are identical in terms of settings, except for the paths (dev/prod):


<VirtualHost *:80>


why this difference when the settings are strictly identical? Do I need to add EnableSendfile off in my conf files to stop that?

Posted: 03-02-2010, 06:26 PM

View 14 Replies!   View Related
CentOS 5 :: Bash Script Under Cron Produces Broken Pipe
I have script which does file locking via flock and then writing it's pid into that file. It perfectly works being run by hand in terminal, running under cron on Debian, but somehow fails being run under cron on Centos 5.6. Script part and straced outputs are below.

bash code:

#setting lock
mylog "setting lockfile $LOCKFILE"
exec 200<> $LOCKFILE


Posted: 2011/4/20 8:33

View 4 Replies!   View Related
Server :: Bash Scripting Sending Write Error - Broken Pipe
I move a page from a server in SuSe to Debian and this script was working well but when I move the page to a Debian base server it is sending in the logs the following message:

cat: write error: Broken pipe, referer: [URL]

The cgi does the following, read a db file plain text that repeat each 15 lines an information where to look the seraching info. if it is there sends to the output the 15 lines block. but it was not sending errors in suse distro, does anybody knows why the cat's line are sending "cat: write error: Broken pipe," if I am not writing or making a pipe with ">" to none file.

Posted: 04-19-2010, 05:39 PM

View 8 Replies!   View Related
Fedora :: Error - Courier-imap Standard Output: Broken Pipe
I'm following the "The Perfect Server - Fedora12 x86_64 [ISPConfig 3]" instructions and I am encountering an error when trying to build the rpm for courier-imap (from page 4 of the HOWTO).

The command I run is:


rpmbuild -ta courier-imap-4.6.0.tar.bz2

The error is below:


INFO: LOGIN, user=confmdtest, ip=[], port=[0], protocol=SMAP1
INFO: LOGOUT, user=confmdtest, ip=[], headers=0, body=0, rcvd=26, sent=610, time=0
sort: fflush failed: standard output: Broken pipe


RPM build errors: Bad exit status from /var/tmp/rpm-tmp.85697 (%build)

Posted: 07-22-2010, 07:03 AM

View 3 Replies!   View Related
Debian :: Can't Upgrade Anything - Dpkg-deb: Subprocess Paste Killed By Signal (Broken Pipe) Errors Were Encountered While Processing
Unpacking replacement ffmpeg ... dpkg: error processing /var/cache/apt/archives/ffmpeg_5%3a0.5.1+svn20100411-0.0_i386.deb (--unpack): trying to overwrite '/usr/share/ffmpeg/libx264-ipod640.ffpreset', which is also in package libavcodec52 4:0.5.1-3 dpkg-deb: subprocess paste killed by signal (Broken pipe) Errors were encountered while processing: /var/cache/apt/archives/ffmpeg_5%3a0.5.1+svn20100411-0.0_i386.deb E: Sub-process /usr/bin/dpkg returned an error code (1)

Posted: 2010-04-23 11:38

View 9 Replies!   View Related
Programming :: Pipe Output Of Ls To File?
I want to pipe the output of ls in a folder to a file (lets call it test.txt) but when i do so, but when i do ls > test.txt in test.txt there is also test.txt (logical

Posted: 05-03-2011, 03:46 PM

View 4 Replies!   View Related
Programming :: Getting The Name Of The Process That Sent Data To A Pipe?
I am trying to automate some directory naming when we're manually running some scripts and are using tee to direct the output to a file (log). Right now this is what we do


./ 2>&1 | tee /home/user/some_dir/logs/manual/some_script_20110216_1628.log

As a matter of laziness and keeping the log files consistently named, I'd like to create a function to pipe it to so that it's doing all the naming How I envision the command running


./ 2>&1 | myfunc

And what the logfile name should look like (and in the right directory)



I was thinking of adding a function to our profile to handle this. Just in testing I was trying to stream line right on the command line, but I'm having some difficulty in getting the name of the script that is pushing data over the pipe. Here is what I've tried


./ 2>&1 | tee $(cd ../logs/manual; pwd)/$0_$(date +%Y%m%d)-$(date +%H%M).log

but that created a file named


Posted: 02-16-2011, 03:38 PM

View 3 Replies!   View Related
Programming :: BASH: Get PID Of First Command In Pipe
I understand that $! is the PID of a command. For example:

Code: #!/bin/bash
myprogram &
echo "PID of myprogram is $!"

I'd like to send the output of "myprogram" to both console and to a log file using the "tee" command but I also want to store the PID of "myprogam". Something like this:

Code: #!/bin/bash
myprogram | tee ./logfile &
echo "PID of myprogram is $!"

The problem is that $! is now the PID of "tee" rather than the PID of "myprogram".

Posted: 08-11-2010

View 3 Replies!   View Related
Programming :: Pipe Output To Gtkdialog?
For instance, suppose I want to pipe the output of ps -A to a gtkdialog table.

Posted: 04-05-2011, 04:44 PM

View 1 Replies!   View Related
Programming :: Use Pipe In Excel Function?
In shell, I execute "./ffmpeg -f h264 - | xxx"

Now I hope use execl function to execute above operations,

I call execl("/bin/sh", "sh", "-c", "./ffmpeg -f h264 - | xxx");

but ffmpeg doesn't work, it seems that "|" pipe don't work.

how could I solve this?

Posted: 04-13-2010

View 1 Replies!   View Related
Ubuntu :: SSH "Write Failed: Broken Pipe" For Some Users
I am having a truly bizarre problem when trying to set up my sheeva plug as a backup server. I have four users (one for each member of my family) that I want to give permission to ssh in (well, sftp in but they're essentially the same) and backup to an external harddrive.

My user works perfectly well and has done since I got the plug. So does a transmission user I set up to run the transmission daemon. With the other three users, however, I get the following error after SSH asks for the user's password:


Write failed: Broken pipe

This happens whether I try locally or over my network. I haven't been able to find a solution to it at all. I've made sure that /bin/bash was set as the shell and that the home directory is writeable with the correct permissions (ls -al /home):


drwxr-xr-x 7 root root 4096 Dec 21 19:25 .
drwxr-xr-x 21 root root 4096 Dec 17 19:27 ..


The alternative for me would be to use netatalk and AFP but the problem is that there is no native support for AFP and so things like d�ja dup backup may not be able to mount the afp drive...

Posted: May 10th, 2010

View 4 Replies!   View Related
Software :: Put Ssh Into Remote Machine - Error Write Failed: Broken Pipe (After Logged Into That Machine)
Whenever I put ssh into remote machine am getting the following messages. Write Failed: Broken Pipe (After logged into that machine ) Read Socket Failed: Connection reset by peer (While trying to log in ) Also known_hosts file is changed frequently.

Posted: 07-18-2011, 05:47 AM

View 1 Replies!   View Related
Programming :: Kill Processes Which Is Connected With Pipe?
i want kill processes which is connected with pipe for example i have running these processes:

a. process_1 | process_2
b. process_1 | process_3
c. process_1 | process_4
d. process_1 | process_5

i have a pid of process which i want kill:

PID3=`pidof -x process_3`


kill -9 $PID3 -> kill process_3 but process "process_1" from case b. is still running.

Posted: 06-14-2007, 02:51 PM

View 3 Replies!   View Related
Programming :: Pipe Output To 2 Files But Not STDOUT?
I want to have the output of a program go to 2 different files but not going to standard out. Is there a way to do this in bash? I know that in Z shell its really easy. omething like: Code: echo "test" >> file1 >> file2 Would work. But in Bash it doesn't seem that easy. I know that tee will send the output to 2 files but it also sends it to STDOUT.Something like:Code: echo "test" | tee -a file1 file2 Would put the word "test" in file1, file2, and STDOUT. Is there a way to just send the output to file1 and file2?

Posted: 03-24-2011

View 2 Replies!   View Related
Programming :: Detect Pipe From Running C Program?
I'm looking for a way to detect whether or not a program has been called from pipe, e.g.


whatever | my_program
versus simply just being exectuated directly:



Why? In the first case, I want to run the program non-interactively, and in the latter case I want to print out user-friendly messages. I've been thinking along the lines of some check I haven't yet found, like:


if( stream_buffer_is_not_empty() )

Posted: 01-24-2009, 07:51 PM

View 1 Replies!   View Related
Programming :: Clearing Stdin Obtained From Pipe
I have a small program that reads stdin from a pipe using fgets. Now fgets blocks for the first line but after that it will not block.

The code, my_echo.c -
int main(int argc, char **argv) { char buf [2000] ;
char* pc ; printf("hello ") ; while (1)
{ buf[0] = (char) 0 ;
pc = fgets(buf, sizeof(buf), stdin);
if (pc != NULL) printf("%s ",buf); } return 0; }

How its called
* In terminal window 1: ./my_echo < my_fifo
* In terminal window 2: echo "1234" > my_fifo
* In terminal window 1: prints hello then 1234.
* Checking with ksysguard or top shows that my_echo is consuming 40% of CPU time.

Adding a few printf's shows that the gets is not blocking and returns a null pointer.
* In terminal window 2: echo "qwerty" > my_fifo
* In terminal window 1 qwerty prints.
I want a read function that does in fact block so my program does not tie up CPU time, read does not block.

Posted: 03-14-2010, 09:20 AM

View 7 Replies!   View Related
Programming :: Ipc Between Parent And Child Processes Using Pipe?
If a process forks its child and communicate with the child using pipe, do closing the write end of the pipe and terminating the writing process have the same effect?

Posted: 10-13-2010, 10:49 PM

View 3 Replies!   View Related
Copyright 2005-08, All rights reserved