accept Function

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
accept Function
C
SOCKET accept(
    SOCKET s, 
    struct sockaddr* addr, 
    int* addrlen
);
Description

The accept function is used to accept connection requests queued for a listening socket. If a connection request is pending, accept removes the request from the queue, and a new socket is created for the connection. The original listening socket remains open and continues to queue new connection requests. The socket must be a SOCK_STREAM type socket.

Preconditions

listen function should be called.

Parameters
Parameters 
Description 
Socket descriptor returned from a previous call to socket. must be bound to a local name and in listening mode. 
addr 
Optional pointer to a buffer that receives the address of the connecting entity. 
addrlen 
Optional pointer to an integer that contains the length of the address addr 
Returns

If the accept function succeeds, it returns a non-negative integer that is a descriptor for the accepted socket. Otherwise, the value INVALID_SOCKET is returned.

Remarks

None.

Microchip TCP/IP Stack 5.42.08 - June 15, 2013
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.