[zeromq-dev] patch: non-blocking tcp accept
Martin Sustrik
sustrik at fastmq.com
Tue Apr 28 12:35:23 CEST 2009
Hi Dhammika,
> Patch to add non-blocking tcp accept.
>
> 1. sets non-blocking flag in tcp listener socket
> 2. moves accept to tcp_listener.in_event()
> 3. passes native socket descriptor to tcp_socket constructor
>
> Builds and tested on linux.
> Would appreciate if someone can run a quick build on a win32 box.
> Hopefully it'll build without any drama.
>
> Requires few changes in zmq_server, perf and examples (mainly in
> tcp_socket constructor).
> If we're happy with this, I'll send a full patch.
The patch looks OK. Please, do send the full patch (and state it's
licensed under MIT license).
The one thing I'm unsure of is EAGAIN/EWOULDBLOCK distinction. It seems
that both Linux and Win32 assign the same numeric value to both errors.
I am not sure of other platforms.
POSIX says:
[EAGAIN]
Resource unavailable, try again (may be the same value as
[EWOULDBLOCK]).
[EWOULDBLOCK]
Operation would block (may be the same value as [EAGAIN]).
Pretty confusing...
Martin
More information about the zeromq-dev
mailing list