Dart.PowerTCP.SslSockets Namespace > Server Class : Abort Method (Server) |
Stops the server application and immediately closes all connections.
[Visual Basic]
Public Sub Abort()
[C#]
public void Abort();
[C++]
public: void Abort();
[C++/CLI]
public:
void Abort();
This method causes the Server object to stop listening for new connections and to immediately close all current connections. Calling this method causes the ActiveChanged event to be raised.
If you would simply like to stop listening for new connections while keeping active connections, use Close.
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
Send comments on this topic.
Documentation version 1.1.2.0.
© 2008 Dart Communications. All rights reserved.