Tuesday, February 10, 2009

connect() returns EBADF when run in thread

At least temporarily resolved EBADF error on socket connect by setting socket to non-blocking mode after connect.  This means that real socket-connect failures may block.  

Another possibility is to ignore the EBADF return from connect and come back and check socket connect status after a short delay, similar to EINPROGRESS handling.

Note that this error does not occur when connect is run in a non-threaded program (tst conn), only when connect is called from within a thread (tst tconn).


No comments:

Post a Comment