示例#1
0
 /// <summary>
 /// Closes the <see cref="T:System.Net.Sockets.Socket"/>.
 /// </summary>
 public void Close()
 {
     lock (syncRoot)
     {
         if (socket != null)
         {
             socket.Close();
             socket = null;
         }
     }
 }
示例#2
0
 /// <summary>
 /// Stops the listening and closes the socket.
 /// </summary>
 public void Stop()
 {
     if (log.IsDebugEnabled)
     {
         log.DebugFormat("Stopp listening on {0}", LocalEndPoint);
     }
     lock (_lock)
     {
         running = false;
         if (socket != null)
         {
             socket.Close();
             socket = null;
         }
     }
 }