TCPBind


C Specification

#include <dolphin/ip.h>

typedef struct IPSocket
{
     u8 len; // IP_SOCKLEN
     u8 family; // IP_INET
     u16 port;
     u8 addr[IP_ALEN];
} IPSocket;

s32 TCPBind ( TCPInfo* info, const IPSocket* socket );

Description

TCPBind() assigns the local (source) socket to TCPInfo.

Note: In general, a listening info should reuse the socket even if there is other TCPInfo that uses the same local socket. To do so, call TCPSetSockOpt() with the SO_SO_REUSEADDR option enabled.

Arguments

info Pointer to TCPInfo to which assign the local socket.
socket A pair of IP address and TCP port number

Return Values

IP_ERR_NONE Succeeded.
IP_ERR_INVALID info is not a valid TCPInfo. Specified socket is not valid.
IP_ERR_INV_SOCKET Specified socket address is not valid for the local machine
IP_ERR_EXIST Specified socket is already in use

See Also

IPSocket