BitSharper.NetworkConnection.Shutdown C# (CSharp) Method

Shutdown() public method

Shuts down the network socket. Note that there's no way to wait for a socket to be fully flushed out to the wire, so if you call this immediately after sending a message it might not get sent.
public Shutdown ( ) : void
return void
        public virtual void Shutdown()
        {
            _socket.Disconnect(false);
            _socket.Close();
        }

Usage Example

Example #1
0
 /// <summary>
 /// Terminates the network connection and stops the message handling loop.
 /// </summary>
 public void Disconnect()
 {
     lock (this)
     {
         _running = false;
         try
         {
             // This is the correct way to stop an IO bound loop
             if (_conn != null)
             {
                 _conn.Shutdown();
             }
         }
         catch (IOException)
         {
             // Don't care about this.
         }
     }
 }