apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@gmail.com>
Subject Re: Portable WSAEWOULDBLOCK
Date Thu, 30 Sep 2004 13:06:25 GMT
On Wed, 29 Sep 2004 20:14:41 -0600, David Barrett <dbarrett@quinthar.com> wrote:
> Sockets are coming along, but I can't find a portable way of distinguishing
> between a failed or empty "apr_socket_recv( )" on a non-blocking socket.
> Here's what I'm currently doing:
> 
> # rv = apr_socket_recv( s, ... );
> # if( rv != APR_SUCCESS )
> # {
> #       if( rv == APR_EOF ) {
> #               // Graceful shutdown from other side
> #       }
> #       else if( APR_TO_OS_ERROR( rv ) == WSAEWOULDBLOCK ) {
> #               // No error, just no data

use APR_STATUS_IS_EAGAIN(rv) to check for this condition

the doc for the APR_SO_NONBLOCK socket option should mention that when
this is enabled, send and recv functions will return such a status if
the operation cannot be performed without blocking (or, change the doc
for every send and recv function)

Mime
View raw message