Stop
Description: This method is used to stop a running socket server. It halts the server, stops listening for new connections, and closes active connections. For both TCP and UDP servers, this method prevents further operations and releases resources.
Parameters: This method does not take any parameters.
Returns: This method does not return any value; the server is stopped.
The Stop()
method is used to stop a running socket server. When invoked, the server ceases to accept new connections, and all active connections are closed. It halts the server’s operations, freeing up resources.
TCP Server: In a TCP server, the
Stop()
method terminates active connections and stops listening for incoming connections. All active client connections are closed, and the server will not accept any new connections. To restart the server, theStart()
method must be called again.UDP Server: In a UDP server, the
Stop()
method stops receiving incoming data packets. Since UDP is connectionless, it does not close any connections. The server simply stops listening for incoming messages.
Important Notes:
When the
Stop()
method is invoked, all active connections are terminated, and operations are halted. To restart the server, theStart()
method needs to be called again.After the server is stopped, no further data exchange occurs, as the connections are closed.
Usage:
Last updated