2014-07-11 22:12:11 +02:00
|
|
|
#include <time.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "sock.h"
|
|
|
|
|
|
|
|
int sock_set_recvtimeout(int sock, int seconds)
|
|
|
|
{
|
|
|
|
struct timeval timeval;
|
|
|
|
memset(&timeval,0,sizeof(timeval));
|
2016-04-12 07:41:43 +02:00
|
|
|
timeval.tv_sec=seconds;
|
2014-07-11 22:12:11 +02:00
|
|
|
return setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,&timeval,sizeof(timeval));
|
|
|
|
}
|