Start
Description: The
Start()
method is used to begin the operation of the socket server. This method initializes the server, starts listening for incoming client connections, and prepares the server to process and exchange messages according to the protocol (TCP or UDP) specified during the creation of the server using theSocketBuilder
.Parameters: This method does not take any parameters.
Returns: This method does not return any value. It initiates the server’s operation.
The Start()
method is used to start the socket server after it has been configured with necessary parameters. When this method is called, the server begins listening for incoming connections (TCP) or messages (UDP) on the specified port and IP address.
TCP Server: For a TCP server, the
Start()
method will initiate the listening process on the specified port and wait for client connections. Once a connection is established, the server can begin exchanging messages with the connected client. The server will continue listening for incoming connections until it is stopped using theStop()
method.UDP Server: For a UDP server, the
Start()
method will begin receiving messages sent to the specified port. Since UDP is connectionless, it does not establish a session like TCP. The server will simply receive and process messages sent to the port without waiting for a connection.
Important Notes:
The server must be configured correctly using
SocketBuilder
before calling theStart()
method.The
Start()
method runs asynchronously and will continue processing messages and connections until the server is stopped using theStop()
method.
Usages:
Last updated