#49 Non blocking socket connect() errno setting

closed
nobody
None
5
2012-10-09
2009-07-02
No

connect() on a non blocking socket should give some way to know that the connection is not ready. This is done on POSIX by returning an error and setting errno to EINPROGRESS. I've used the attached patch for a while, and it means you can do:

int result = connect(tcp_socket, (struct sockaddr*)&socketAddress, addrlen);

if (result != 0 && errno == EINPROGRESS) {
// set some flags and run select or whatever
} else if (result == 0) {
// connected ok
} else {
// fail or whatever
}

It'd be great if this could go into your dswifi so I didn't have to remember to patch it each time! :-)

Discussion

  • Dave Murphy

    Dave Murphy - 2009-07-07

    commited to svn, will be part of 0.3.10, thanks for the patch, much appreciated

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks