1.2.1.2.99 TCPIP_BSD_Socket Function

C

int TCPIP_BSD_Socket(
    SOCKET s
);

Description

The function returns the native socket number associated with the BSD socket. Using this call the caller can switch to the native TCP/IP API.

Preconditions

The socket() function should have been called.

Parameters

ParametersDescription
sSocket descriptor returned from a previous call to socket().

Returns

  • >= 0 - If function is successful. Value refers to socket number.

  • -1 - No such socket exists and errno is set to EBADF.

Remarks

This function works for both TCP and UDP sockets.

The native UDP sockets are created after a call to bind (server sockets) or connect (client sockets). The native TCP sockets are created after a call to listen() (server sockets) or connect() (client sockets). Please note that calling the TCPIP_BSD_Socket before one of these calls will return an INVALID_SOCKET.

The BSD module uses the NET_PRES layer for supporting encrypted connections. This function returns the transport socket (TCP/UDP) associated with the NET_PRES connection. See TCPIP_BSD_PresSocket for getting the NET_PRES socket.