I'm seeing unexpected behavior when I use "apr_opt_set( s, APR_SO_NONBLOCK, 1 )" in conjunction with "apr_socket_timeout( s, 0 )". Basically, the following code generates no error return values:

1# apr_socket_create( &s, APR_INET, SOCK_STREAM, APR_PROTO_TCP, pool );
2# apr_opt_set( s, APR_SO_NONBLOCK, 1 );
3# // apr_socket_timeout( s, 0 );
4# apr_socket_connect( s, addr );

However, if I uncomment line #3, then line #4 returns SOCEINPROGRESS. (Note, that is different than EAGAIN, which is tied to SOCEWOULDBLOCK.) The full error message is "A blocking operation is currently executing."

Why is this? I *think* I'm supposed to both set non-blocking and zero timeout, but this is causing me errors. Am I supposed to do something different?

As a workaround I'll just leave line #3 commented, but I think this'll create portablility problems when I compile on Linux. Any ideas what I'm doing wrong?

Thanks!

-david

Reply via email to