Functions and Directives

Function SocketAccept() Professional

Waits until a connection is present.

SocketAccept( <nServerSocket>, ;
              [@<nError>]      ) --> nSocket
This is a numeric socket descriptor previously created with SocketNew() or SocketCreate().
If this parameter is passed by reference to the function, it gets assigned a numeric error code when the function fails. #define constants beginning with WSAE are available in the file SOCKET.CH to identify an error condition.

The function returns a socket descriptor for an incoming connection.


The function SocketAccept() is used by a server process for accepting client requests. Before connections can be accepted, a socket must listen to incoming requests which is achieved with the SocketListen() function. When a client connects to the server, SocketAccept() returns a new socket descriptor which can be used for data exchange with the client process. The original socket <nServerSocket> remains open and may accept new client connections. If there is no client request, the server process is blocked until a client connects to the server, unless the server socket is in nonblocking mode.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.