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:
When a connection request arrives, the command finishes with a message that is similar to the following message:SOCKET TYPE=SELECT READ=xBNH610I 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:
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.SOCKET TYPE=ACCEPT SOCKID=0BNH612I SOCKET 0 ACCEPTED CONNECTION FROM 0:0:0:0:0:0:0:1 PORT 1032. SOCKET 1 HAS BEEN ALLOCATEDIf 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:
A successful result is indicated by a message that is similar to the following message:SOCKET TYPE=ACCEPT SOCKID=0
Socket 2 can then be used for communication with that client.BNH612I SOCKET 0 ACCEPTED CONNECTION FROM 10.12.45.27 PORT 1034. SOCKET 2 HAS BEEN ALLOCATED