Creating listening sockets

Listening Sockets

Listening sockets are sockets that you can use to listen for attempts by other sockets to establish a connection. Usually listening sockets are created by server socket programs that need to know when client socket programs want to connect. In order to create listening socket, you need to do three things:

  1. Create a data socket (see creating a data socket)
  2. Bind the socket to a local address (see the bind function)
  3. Convert the data socket into a listening socket (see the listen function)