ChinaUnix.net
相关文章推荐:

socket SIGPIPE

请问各位是否程序里面必须屏蔽掉sigpipe呢? signal(sigpipe, SIG_IGN);

by demiurge - C/C++ - 2012-08-25 12:32:24 阅读(1736) 回复(9)

相关讨论

在一个程序中只需要设置一次sigpipe信号,还是每次调用socket的时候都需要设置一次sigpipe? 程序会多次调用socket

by kingwkb - C/C++ - 2008-08-17 17:08:12 阅读(2251) 回复(10)

如果你在读取一个管道、套接口、FIFO等设备时,当写入端关闭连接时,你将会得到一个文件结束符(EOF)(read()返回零字节读取)。 如果你试图向一个管道或套接口写入,当读取方关闭连接,你将得到一个sigpipe的信号,它会使进程终止除非指定处理方法。(如果你选择屏蔽或忽略信号,write()会以EPIPE错误退出。) ----------------------------------- 问题是: 读取的时候好处理,写...

by pcerma - C/C++ - 2008-05-08 23:14:49 阅读(6818) 回复(6)

程序为什么没有出现sigpipe呢? [code] #include #include main() { int pipe_fd[2]; pid_t pid; char r_buf[4]; char* w_buf; int writenum; int cmd; memset(r_buf,0,sizeof(r_buf)); if(pipe(pipe_fd)<0) { printf("pipe create error\n"); return -1; } if((pid=fork...

by 苦中作乐 - C/C++ - 2006-09-02 17:03:59 阅读(732) 回复(2)

做了一个LINUX下的服务器程序,大致代码是 main() { sem_t procBlock; sem_init(&procBlock, 0, 0); struct sigaction act, oact; act.sa_handler = SIG_IGN; sigemptyset(&act.sa_mask); act.sa_flags = 0; act.sa_flags |= SA_RESTART; if(sigaction(sigpipe, &act, &oact) < 0) { printf("disable::sigaction"); return 0; } ServerThread pThread...

by crystalqun - C/C++ - 2008-12-23 18:01:33 阅读(830) 回复(0)

我用signal(sigpipe,SIG_IGN);屏蔽sigpipe信号屏蔽不了,为什么阿? 我该如何避免因为这个信号导致的进程退出

by 空灵静世 - C/C++ - 2007-03-06 17:28:05 阅读(4135) 回复(13)

我的系统是redhat-2.4.32,向一个对端未打开的FIFO进行写操作,不会引发sigpipe,但是man 4 fifo上面说这样做会引发sigpipe [code] NOTES When a process tries to write to a FIFO that is not opened for read on the other side, the process is sent a sigpipe signal. FIFO special files can be created by mkfifo(3), and are specially indi- cated in ls -l. SEE ALSO mkfifo(3), ...

by isnowran - C/C++ - 2006-08-11 10:40:39 阅读(1284) 回复(5)

在GDB里面程序收到sigpipe信号挂了,请问是什么原因:em14:

by @sky - C/C++ - 2008-10-17 16:55:25 阅读(1347) 回复(3)

#include #include #include #include #pragma comment(lib, "Ws2_32.lib") int main() { int server_fd,client_fd; int server_len,client_len; struct sockaddr_in server_address; struct sockaddr_in client_address; server_fd=socket(AF_INET,SOCK_STREAM,0); server_address.sin_family=AF_INET; server_address.sin_port=8888; server_address...

by yutao132 - C/C++ - 2009-06-29 09:48:01 阅读(818) 回复(9)

为什么程序只运行到bind时就失败了呢,运行显示是:socket ok bind UNknown error 哪位能给指点一下嘞!!! #!/usr/bin/perl # The server and the client are on the same machine. $AF_INET=1; # The domain is AF_INET $SOCK_STREAM=1; # The type is SOCK_STREAM $PROTOCOL=0; # Protocol 0 is accepted as the "correct ...

by 洲洲young - Perl - 2009-01-04 16:29:05 阅读(1625) 回复(7)

socket编程,如果客户端联上了服务器之后,不等服务器发送数据就自己断开了连接。 服务器的send函数怎么没返回错误呢?errno也没错?

by greenwillow280 - C/C++ - 2008-07-11 19:15:13 阅读(1166) 回复(5)