Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. struct timeval timeout;      
  2.     timeout.tv_sec = 180;
  3.     timeout.tv_usec = 0;
  4.  
  5.     if (setsockopt (sockfd, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout,
  6.                 sizeof(timeout)) < 0)
  7.         perror("setsockopt failed\n");
  8.  
  9.     if (setsockopt (sockfd, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout,
  10.                 sizeof(timeout)) < 0)
  11.         perror("setsockopt failed\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement