Microsoft Windows CE 3.0  

accept

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This function accepts a connection on a socket.

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

Parameters

s
[in] Descriptor that identifies a socket that has been placed in a listening state with the listenfunction. 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. The exact format of the addrparameter is determined by the address family established when the socket was created. Set to NULL for IrSocket implementation.
addrlen
[out] Optional pointer to an integer that contains the length of the address addr. Set to NULL for IrSocket implementation.

Return Values

The return value is a handle for the socket on which the actual connection is made. INVALID_SOCKET indicates failure. To get a specific error value, call WSAGetLastError. The following table shows common error values.

Windows CE does not support the WSACancelBlockingCallfunction; however, Windows CE returns the WSAEINTR error value if closesocketis called in the middle of executing a sockets call.

The integer referred to by addrleninitially contains the amount of space pointed to by addr. On return it contains the actual length in bytes of the address returned.

Remarks

For Infrared Sockets (IrSock), set the addrand addrlenparameters to NULL.

The acceptfunction extracts the first connection on the queue of pending connections on socket s.It then creates a new socket and returns a handle to the new socket. The newly created socket is the socket that will handle the actual connection and has the same properties as socket s. The newly created socket sdoes not have the listening socket's group identifier, if any was applied.

The acceptfunction can block the caller until a connection is present if no pending connections are present on the queue, and the socket is marked as blocking. If the socket is marked nonblocking and no pending connections are present on the queue, acceptreturns the WSAEWOULDBLOCK error value. The socket handle returned from a successful accept call cannot be used to accept further connections. The original socket remains open to listen for new connection requests.

The parameter addris a result parameter that is filled in with the address of the connecting entity, as known to the communications layer. The exact format of the addrparameter is determined by the address family in which the communication is occurring. The addrlenis a value-result parameter; it should initially contain the amount of space pointed to by addr; on return it will contain the actual length (in bytes) of the address returned.

The acceptfunction is used with connection-oriented socket types such as SOCK_STREAM.

If addrand/or addrlenare equal to NULL, then no information about the remote address of the accepted socket is returned.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winsock.h    
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

bind, connect, listen, select, socket