> +    int nbytes;
> +    while (true)
> +    {
> +        nbytes = ::send (w, (char *)&cmd_, sizeof (command_t), 0);
> +        if ((nbytes == SOCKET_ERROR) &&
> +            (GetLastError () == WSAEWOULDBLOCK))
> +            Sleep (1);
> +        else
> +            break;
> +    }

Is it correct that you want to return for any case that is not
WSAEWOULDBLOCK? This means you will immediately return for any other
error (which is probably right), and for all non-error cases (partial
sends?).

Any chance you might have an infinite loop here, if send() keeps
returning WSAEWOULDBLOCK? Should you limit the amount of times this loop
could be executed?

Is it OK to always sleep 1 ms? Should you implement some kind of
exponential back-off?

Just wondering...

-- 
Gonzalo Diethelm

_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to