Пример #1
0
 internal void SetSocketTimeout(BaseSocket sock, int timeout)
 {
     if (timeout > 0)
     {
         try
         {
             sock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, timeout);
             sock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, timeout);
         }
         catch (SocketException exception)
         {
             this.log.Warn("Failed to set socket timeout: " + exception.Message);
         }
     }
 }
Пример #2
0
 /// <summary>  
 /// Helper method to set a socket's timeout value
 /// </summary>
 /// <param name="sock">
 /// socket to set timeout for
 /// </param>
 /// <param name="timeout">
 /// timeout value to set
 /// </param>
 internal void SetSocketTimeout(BaseSocket sock, int timeout)
 {
     if (timeout > 0)
     {
         sock.SetSocketOption(SocketOptionLevel.Socket,
             SocketOptionName.ReceiveTimeout, timeout);
         sock.SetSocketOption(SocketOptionLevel.Socket,
             SocketOptionName.SendTimeout, timeout);
     }
 }