Add timeout to smo sockets (#1651)
* Add timeout to smo sockets Without this sometimes an attempt at a connection hangs and completely stops the program (VERY annoying in fullscreen) in the recv function. * Fix typo from previous commit * Change smo timeout to 5
This commit is contained in:
@@ -173,6 +173,10 @@ bool EzSockets::create(EzSockets_Proto Protocol, int Type)
|
||||
}
|
||||
|
||||
data->sock = socket(AF_INET, Type, realproto);
|
||||
if (data->sock > SOCKET_NONE) {
|
||||
struct timeval tv = { 5, 0 };
|
||||
setsockopt(data->sock, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv, sizeof(struct timeval));
|
||||
}
|
||||
lastCode = data->sock;
|
||||
return data->sock > SOCKET_NONE; // Socket must be Greater than 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user