02-09-2009
Non-blocking pipe
Hello,
Would this be an acceptable way of creating a non-blocking pipe.
Basically I want to create kind of a server client arch.
This code would be in the server, and I don't want to have to wait for
clients to read before moving on to the next client. One problem I
can see is if a client leaves/dies and never reads from the pipe(but I
could have some trap/cleanup stuff in the clients for that).
# assigning fd 3 to the pipe
echo "exec 3>myfifo && echo 'a' >&3 && echo 'b' >&3 && echo 'c' >&3 &&
exec 3>&-" | at now
Chris.
Last edited by Neo; 02-09-2009 at 05:25 PM..
Reason: removed self promoting link of new member
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Dear All ,
Kindly note I have sun solaries 7 .
I want to block a domain who keep sending emails to my domain and users .
thanks (1 Reply)
Discussion started by: tamemi
1 Replies
2. IP Networking
I'm in highschool. They blocked my favorite site. How do I disable websense without getting caught on that particular webpage? Is it even possible? *twitch* I would also like to get as much UNIX for beginners information, so if someone might point me in the right direction so I don't have to read... (1 Reply)
Discussion started by: Satine
1 Replies
3. IP Networking
I've got a legit DHCP server on my network. I've got a 3550 as my VTP server providing 4 vlans to 4 2950 switches. If somebody were to plug into one of those vlans with a DHCP server configured then it would throw off my whole network. How could i block the DHCP server that could plug into the... (2 Replies)
Discussion started by: byblyk
2 Replies
4. Shell Programming and Scripting
Hi!!
I have a problem reading from a fifo pipe in shell script.
The idea is simple, I have a C program with two pipe files:
An input pipe I use to send commands in shell script to the C program (echo "command" > input.pipe)
An output pipe that I read the result of the command also in... (4 Replies)
Discussion started by: victorin
4 Replies
5. UNIX for Advanced & Expert Users
Hi Folks
I have been debugging a script that is called every thirty seconds. Basically it is doing a ps, well two actually, one to file (read by the getline below) and the other into a pipe. The one into the pipe is: -
V_SYSVPS=/usr/sysv/bin/ps
$V_SYSVPS -p$PIDLIST -o$PSARGS... (0 Replies)
Discussion started by: steadyonabix
0 Replies
6. UNIX for Dummies Questions & Answers
I know how to add signal to a set. But what if I want to add 2 or 3 signals to the set.
I know I can use sigaddset (&set,SIGBUS)....but what if I want to add SIGBUS and SIGALRM at once. Do i have to do it like this..
sigaddset (&set,SIGBUS);
sigaddset (&set,SIGALRM);
Is there another way to... (0 Replies)
Discussion started by: joker40
0 Replies
7. Shell Programming and Scripting
Hi All ,
Is there any way to replace the pipe ( | ) with the broken pipe (0xA6) in unix (1 Reply)
Discussion started by: saj
1 Replies
8. IP Networking
Hi
I am starting to practice nmap for my own education.
Now I created two host in virtual box.
Bot are scientific linux, one in installed as web server and the other as developing station.
I tried to run nmap on so I did nmap on their IP address, I got an answer that ip is down or that... (8 Replies)
Discussion started by: programAngel
8 Replies
9. Shell Programming and Scripting
Hi guys,
I need to know how i can ignore Pipe '|' if Pipe is coming as a column in Pipe delimited file
for eg:
file 1:
xx|yy|"xyz|zzz"|zzz|12...
using below awk command
awk 'BEGIN {FS=OFS="|" } print $3
i would get xyz
But i want as :
xyz|zzz to consider as whole column... (13 Replies)
Discussion started by: rohit_shinez
13 Replies
10. Programming
among the below socket programming api's, please let me know which are blocking and non-blocking.
socket
accept
bind
listen
write
read
close (2 Replies)
Discussion started by: VSSajjan
2 Replies
LEARN ABOUT PHP
stream_set_blocking
STREAM_SET_BLOCKING(3) 1 STREAM_SET_BLOCKING(3)
stream_set_blocking - Set blocking/non-blocking mode on a stream
SYNOPSIS
bool stream_set_blocking (resource $stream, int $mode)
DESCRIPTION
Sets blocking or non-blocking mode on a $stream.
This function works for any stream that supports non-blocking mode (currently, regular files and socket streams).
PARAMETERS
o $stream
- The stream.
o $mode
- If $mode is 0, the given stream will be switched to non-blocking mode, and if 1, it will be switched to blocking mode. This
affects calls like fgets(3) and fread(3) that read from the stream. In non-blocking mode an fgets(3) call will always return right
away while in blocking mode it will wait for data to become available on the stream.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
NOTES
Note
This function was previously called as set_socket_blocking(3) and later socket_set_blocking(3) but this usage is deprecated.
SEE ALSO
stream_select(3).
PHP Documentation Group STREAM_SET_BLOCKING(3)