Server socket methods

In a client-server architecture, there is a central server that provides services to a set of machines that connect. These are the main methods we can use from the point of view of the server:

  • socket.bind(address): This method allows us to connect the address with the socket, with the requirement that the socket must be open before establishing the connection with the address
  • socket.listen(count): This method accepts as a parameter the maximum number of connections from clients and starts the TCP listener for incoming connections
  • socket.accept(): This method allows us to accept connections from the client. This method returns two values: client_socket and client address. client_socket is a new socket object used to send and receive data. Before using this method, you must call the socket.bind(address) and socket.listen(q) methods