|
|
SIGPIPE doesn't work in Cygwin?
Consider the following code (assume "sock" is the fd of a connected
socket and there is a client reading what we write):
while (1) {
write(sock,str,strlen(str));
sleep(1);
}
Now, under Unix this works fine; if/when the client goes away, we get a
SIGPIPE and the process is killed. This is good.
But, under Cygwin (current version - installed sometime in the last week
or two), it seems SIGPIPE isn't working. The above code continues to
run even after the client is killed.
Note that changing the above to:
while (1) {
if (write(sock,str,strlen(str)) != strlen(str)) _exit(0);
sleep(1);
}
does work, so that's my workaround. Still, it would be nice if the
Unixy (simpler) way worked.
--
> No, I haven't, that's why I'm asking questions. If you won't help me,
> why don't you just go find your lost manhood elsewhere.
CLC in a nutshell.
|
|
0
|
|
|
|
Reply
|
gazelle3 (1608)
|
5/18/2010 7:14:33 PM |
|
On May 18, 12:14=A0pm, gaze...@shell.xmission.com (Kenny McCormack)
wrote:
> Consider the following code (assume "sock" is the fd of a connected
> socket and there is a client reading what we write):
>
> while (1) {
> =A0 =A0 write(sock,str,strlen(str));
> =A0 =A0 sleep(1);
> =A0 =A0 }
>
> Now, under Unix this works fine; if/when the client goes away, we get a
> SIGPIPE and the process is killed. =A0This is good.
>
> But, under Cygwin (current version - installed sometime in the last week
> or two), it seems SIGPIPE isn't working. =A0The above code continues to
> run even after the client is killed.
Windows sockets are not POSIX-compliant.
http://tangentsoft.net/wskfaq/articles/bsd-compatibility.html
DS
|
|
0
|
|
|
|
Reply
|
David
|
5/19/2010 1:47:05 AM
|
|
|
1 Replies
69 Views
(page loaded in 0.054 seconds)
Similiar Articles: ln-s does not work.. why? (using cygwin in Windows XP) - comp.unix ...I didn't complete reinstall cygwin... but i just ran the setup.exe.. and reinstalled bash ... II on Debian GNU/Linux - comp.arch.fpga... uses LESTIF which doesn't > work. why doesn't wprintf work - comp.unix.programmerwhy doesn't wprintf work - comp.unix.programmer carloschoenberg@yahoo.com wrote: > $ gcc --version|head -1 ; cat /etc/redhat-release > gcc (GCC) 3.3.3 20040412 (Red Hat ... Broken pipe on Solaris 8 - comp.unix.solarisObviously it doesn't explain why it actually happens in it-self but it's part ... Broken pipe on Solaris 8 - comp.unix.solaris SIGPIPE and C question for Solaris - comp.unix ... how to kill all child when parent exits - comp.unix.programmer ...... because any work they do won't be ... tre of SIGPIPE. ... exits - comp.unix.programmer ..... it would make sense to kill the child processes because any work they do won't ... Sol8 cfgadm doesn't show fc disk? - comp.unix.solaris... you're using a driver from the manufacturer of the card, it doesn't work. ... Sol8 cfgadm doesn't show fc disk? - comp.unix.solaris Does anyone know why cfgadm in Sol 8 ... [command] logger ? - comp.unix.solarisHello, I try to use the "logger" command, because I would like to add some log in a file, but it doesn't work. I had a look in the man, and tried : ... onbeforeunload doesn't work in Safari - comp.lang.javascript ...Any reason why window.onunload won't work? Maybe use both, and have ... firefox cannot be killed, and more... - comp.unix.solaris ... The hotkeys simply won't work. >> >> The ... how to pass socket between threads in the same process - comp.unix ...Hi I use one thread as listening thread, accept tcp connection and try to pass the connect socket to another thread by ipc msg. It doesn't work. Any h... SAS shortcut keys in UNIX - comp.soft-sys.sasF10 for left works, but F11 for right doesn't. However if I manually ... I don't think the function keys work in Unix at all. "Eversmann" <rifazrazeek@gmail.com> wrote in ... OBP devalias question. - comp.unix.solarisHello, I'm working my certification program for ... Moreover "nvedit" + CTRL-L doesn't show me the all ... OBP devalias question. - comp.unix.solaris SIGPIPE and C question ... c - How to prevent SIGPIPEs (or handle them properly) - Stack Overflow... small server program that accepts connections on a TCP or local UNIX ... use send(...,MSG_NOSIGNAL) as a replacement for write() and you won't get SIGPIPE. This should work ... FAQ - Cygwin WikiIf something doesn't work right for you, and it's not covered here or in the latest ... Why doesn't Cygwin tcl/tk understand Cygwin paths? Edit. The versions of Tcl/Tk ... 7/17/2012 9:57:49 PM
|
|
|
|
|
|
|
|
|