Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 1.44 KB

File metadata and controls

55 lines (37 loc) · 1.44 KB

Home

Function name : accept

Group: Windows Sockets 2 (Winsock) - Library: ws2_32


The accept function permits an incoming connection attempt on a socket.


Code examples:

How to create non-blocking Winsock server

Declaration:

SOCKET accept(
  SOCKET s,
  struct sockaddr* addr,
  int* addrlen
);  

FoxPro declaration:

DECLARE INTEGER accept IN ws2_32;
	INTEGER   s,;
	STRING  @ addr,;
	INTEGER @ addrlen
  

Parameters:

s [in] Descriptor identifying a socket that has been placed in a listening state with the listen function. The connection is actually made with the socket that is returned by accept.

addr [out] Optional pointer to a buffer that receives the address of the connecting entity, as known to the communications layer.

addrlen [out] Optional pointer to an integer that contains the length of addr.


Return value:

If no error occurs, accept returns a value of type SOCKET that is a descriptor for the new socket. This returned value is a handle for the socket on which the actual connection is made.

Otherwise, a value of INVALID_SOCKET is returned, and a specific error code can be retrieved by calling WSAGetLastError.