New answers tagged socket
Kqueue is more general, and more complex than epoll. Source: http://www.eecs.berkeley.edu/~sangjin/2012/12/21/epoll-vs-kqueue.html
A workaround is to keep writing something to the socket - once data can't be written nc will exit. (echo -ne "GET / HTTP/1.0\r\n\r\n"; (while true; do echo -e "\n"; sleep 1; done)) | nc example.com 80 This will send empty line to nc once every second until nc can't write to socket and nc will exit. Thanks to Steffen Ullrich for his answer and comments ...
The default behavior of nc is to close the connection if stdin is closed. To change you can use the -q option (like -q -1) on Linux, it might be the same on OS X. See the man page for details. Edit: looks like OS X nc does not support -q switch or anything similar. In this case you need to make sure that stdin gets not closed by doing somehing like this: ( ...
There's no traditional Unix system call for "copy the full contents of one fd to another". Loops of "read a chunk; stop if EOF; write the chunk" were always written in userspace. There are some recent additions like sendfile(2) and splice(2) which allow you to do the equivalent of a read-write loop in a single syscall. Using these can improve performance at ...
Top 50 recent answers are included