Non blocking socket connect() errno setting
Homebrew toolchains for wii, gamecube, 3ds, ds, gba, gp32 and psp
Brought to you by:
wntrmute
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! :-)
Non blocking socket sets EINPROGRESS if it didn't connect
commited to svn, will be part of 0.3.10, thanks for the patch, much appreciated