Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Dispose() [2/2]

virtual void System.Net.Sockets.TcpClient.Dispose ( bool disposing)
inlineprotectedvirtual

Definition at line 410 of file TcpClient.cs.

411 {
412 if (Interlocked.CompareExchange(ref _disposed, 1, 0) != 0 || !disposing)
413 {
414 return;
415 }
416 IDisposable dataStream = _dataStream;
417 if (dataStream != null)
418 {
419 dataStream.Dispose();
420 }
421 else
422 {
423 Socket socket = Volatile.Read(ref _clientSocket);
424 if (socket != null)
425 {
426 try
427 {
428 socket.InternalShutdown(SocketShutdown.Both);
429 }
430 finally
431 {
432 socket.Close();
433 }
434 }
435 }
436 GC.SuppressFinalize(this);
437 }
override void Dispose(bool disposing)
static int CompareExchange(ref int location1, int value, int comparand)
static bool Read(ref bool location)
Definition Volatile.cs:67

References System.Net.Sockets.TcpClient._clientSocket, System.Net.Sockets.TcpClient._dataStream, System.Net.Sockets.TcpClient._disposed, System.Net.Sockets.Socket.Close(), System.Threading.Interlocked.CompareExchange(), System.IDisposable.Dispose(), System.Net.Sockets.Socket.InternalShutdown(), System.Threading.Volatile.Read(), and System.GC.SuppressFinalize().

Referenced by System.Net.NetworkStreamWrapper.Close(), System.Net.NetworkStreamWrapper.CloseSocket(), and System.Net.Mail.SmtpConnection.ShutdownConnection().