Dart.PowerTCP.SslSockets Namespace > Server Class > Dispose Method : Dispose(Boolean) Method |
Releases all resources associated with the object.
The Object.Dispose method abruptly aborts the connection and releases all resources.
Object.Dispose should ONLY be used to release all resources used by the object, and the object should not be used subsequently. If an abort is desired, then Object.Close or Object.Connection.Close if available should be used to terminate activity and reset the object. The Object cannot be used once Object.Dispose or Object.Dispose(true) are called.
The following example demonstrates disconnecting all connected TCP clients.
[Visual Basic]
Private Sub DisconnectAll()
' Before disconnecting all clients, send a message to all connected clients.
Dim tcp As Tcp
For Each tcp In Server1.Connections
tcp.Stream.Write("Disconnecting...")
Next
Try
' Disconnect all
Server1.Abort()
Catch ex As Exception
' Something happened while aborting...just abruptly dispose
Server1.Dispose()
End Try
End Sub
[C#]
private void DisconnectAll()
{
// Before disconnecting all clients, send a message to all connected clients.
foreach(Tcp tcp in server1.Connections)
tcp.Stream.Write("Disconnecting...");
try
{
// Disconnect all
server1.Abort();
}
catch(Exception ex)
{
// Something happened while aborting...just abruptly dispose
server1.Dispose();
}
}
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Server Class | Server Members | Overload List
Send comments on this topic.
Documentation version 1.1.2.0.
© 2008 Dart Communications. All rights reserved.