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:
Nicolas
2018-03-08 22:35:06 -03:00
committed by Colby Klein
parent 1369c1fb39
commit dba5e3f1f1
+4
View File
@@ -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
}