BEE Script: socketaccept socketObj [newsocket=string];
BEE Tag: <beesocketaccept socketObj [newsocket=string]>
The "socketlaccept" command is usually used by a server process. This command accept a connection from the queue (see "socketlisten") and create a new socket for that connection. After the connection is processed, the new socket should be closed and the original socket should be "listened" to again.
If there are multiple connections in the queue, the first one will be "accepted". If there are no connections in the queue, the process will be suspended waiting for the arrival of a new connection.
If the socket is set to non-blocking (see "socketcontrol") and there is no connection in the queue, the process will return an error.
Parameters
socket (the socketObj) is the name of the socket where the new connection is to be accepted.
newsocket is the name of the new socket object to be created for the process to communicate with the process or host making the connection. The address and port of the connection (of the server process) can be obtained from newSock%address and newSock%port respectively, where newSock is the value of the "newsocket" parameter. The address and port of the (client) process and host making the connection can be obtained from newSock%remote:address and newSock%remote:port respectively.
|