coolaj86 / libev-examples

A nice place for simple libev examples. Please contribute.
MIT License
236 stars 84 forks source link

[FYI] unix-echo-server example does not work like you've intended #6

Open zeliard opened 9 years ago

zeliard commented 9 years ago

https://github.com/coolaj86/libev-examples/blob/master/src/unix-echo-server.c#L64-L67

In this case, send() call does not always guarantee to send "n" bytes because cliend->fd is non-blocking mode. So keeping the buffer (str[]) is needed until all buffer contents are flushed out.