Accepting a Connection Request (Server)

A server can anticipate a connection request in the following ways:
  • The SOCKET TYPE=SELECT command, where x is the socket descriptor for the listening socket:
    SOCKET TYPE=SELECT READ=x
    When a connection request arrives, the command finishes with a message that is similar to the following message:
    BNH610I SOCKET x READY FOR 'READ'
  • The SOCKET TYPE=ACCEPT command, which cannot finish until a connection request arrives. For listening socket 0 to accept a connection request, use the following command:
    SOCKET TYPE=ACCEPT SOCKID=0
    A successful result is indicated by a message that is similar to the following message. This message indicates that a connection request came from a client in an IPv6 network and that socket 1 can be used for communication with that client.
    BNH612I SOCKET 0 ACCEPTED CONNECTION FROM 0:0:0:0:0:0:0:1 PORT 1032.  SOCKET 1
        HAS BEEN ALLOCATED
    If the server is notified that another connection request has arrived (another READ event for listening socket 0), this time from a client in the IPv4 network, the same command is used again to accept the connection:
    SOCKET TYPE=ACCEPT SOCKID=0
    A successful result is indicated by a message that is similar to the following message:
    BNH612I SOCKET 0 ACCEPTED CONNECTION FROM 10.12.45.27 PORT 1034.  SOCKET 2
        HAS BEEN ALLOCATED
    Socket 2 can then be used for communication with that client.