I wrote a small TCP servers with socket()
+ POLLIN poll()
+ recv()
+ send()
, but I don\'t know when to use <
From nginx source, I found that:
If there is some data to send out, nginx tries to send it with a syscall (maybe writev). However, if nginx can not send total data at one time, it will set POLLOUT on pollfd, if using poll event, to wait for a writable event. When getting a writable event, nginx will send the left data.
It is easy to reproduce this case when nginx tries to response large static file