Skip to content

Commit

Permalink
Add timeout to smo sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Mar 11, 2018
1 parent f6f049b commit b52c34d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ezsockets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ bool EzSockets::create(int Protocol, int Type)
{
state = skDISCONNECTED;
sock = socket(AF_INET, Type, Protocol);
if (sock > SOCKET_NONE) {
struct timeval tv = { 2, 0 };
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv, sizeof(struct timeval));
}
lastCode = sock;
return sock > SOCKET_NONE; // Socket must be Greater than 0
}
Expand Down

0 comments on commit b52c34d

Please sign in to comment.