@CHIP-RTOS C Library - TCP/IP API
accept
Accept the next incoming connection. int accept ( int sd,
struct sockaddr far *addressPtr,
int *error ); Parameters
sd
- Socket descriptor (must be switched into
listen mode using listen API).
addressPtr
- Optional output parameter: Pointer to a
sockaddr_in (IPv4)
or sockaddr_in6
(IPv6, SC1x3/SC2x only!
) data structure.
On success, this function fills in this sockaddr_in or sockaddr_in6 structure with the
IP address and port number of the accepted connection.
This pointer can be set to NULL if this address and port number report is not desired.
error
- Output parameter: Failure
code, 0 on success.
Return Value
- -1: Failure, error code output to error
otherwise: New socket descriptor for the connection
Comments
- This call is used by a TCP server.
This API function extracts the first connection on the queue
of pending connections. It then creates
a new socket for this connection. This new socket will have
the same socket options as the listening socket, sd.
On success, the handle to this new socket is returned.
This function's prototype uses a pointer to the
generic type sockaddr
for its addressPtr
parameter,
for compatibility between IPv4 and IPv6 protocols. The pointer to the
sockaddr_in
(IPv4) or sockaddr_in6
(IPv6, SC1x3/SC2x only!
) data structure which
is actually used should be cast to sockaddr
pointer type here
to avoid compiler warnings, "Suspicious pointer conversion".
SC1x3/SC2x Comments- This legacy version of accept()
specified here is not compatible
to the BSD 4.4 Socket API. The accept()
function can be used
in BSD 4.4 compatible mode if the compilation switch
#define BSD44_SOCKET_API_STYLE
is defined in the user application prior to including the Beck C-Library
header files. Using this switch the C-Library TCPIP_Socket.H include
file redefines accept()
to
accept_bsd(). The parameters
to accept_bsd()
are identical to the parameters of the BSD4.4 socket
accept()
function.
See Also
RTOS API
- This library function invokes a RTOS software interrupt.
Refer to this RTOS API function's
documentation
for more details.
Supported since or modified in @CHIP-RTOS version-
| SC12 | SC13 | SC11 | SC1x3 | SC2x |
-
| V1.00 | V1.00 | V1.00 | V0.90 | V1.00 |
This API List
List of C Libraries
@CHIP-RTOS Main Index
End of document
|