BSD Functions

BSD Functions

Function Name

Description

Function Name

Description

accept()

Wait for new socket connections on a listening server socket.

bind()

Assign network addresses to sockets.

close()

Terminate communication and free a socket.

connect()

Connect a local socket to a remote socket address.

FD_CLR()

Remove a socket file descriptor ID as a member of a file descriptor set.

FD_ISSET()

Check if a socket file descriptor ID is a member of a file descriptor set.

FD_SET()

Add a socket file descriptor ID as a member of a file descriptor set. 

FD_ZERO()

Initialize/zero-clear a file descriptor set.

freeaddrinfo()

Free addrinfo structures information that getaddrinfo() has allocated.

gai_strerror()

Converts the numerical value of EAI-type error codes returned by getaddrinfo() into a meaningful string.

getaddrinfo()

Convert human-readable text strings representing hostnames or IP addresses into dynamically allocated linked list of struct addrinfo structures.

gethostname()

Returns the name of the host in a null-terminated c-string array.

getpeername()

Returns the address of the peer connected on a socket.

getsockname()

Converts a socket address to a string describing the host and another string describing the service.

getsockopt()

Get a specific option value on a specific TCP socket.

htonl()

Convert 32-bit integer values from CPU host-order to network-order.

htons()

Convert 16-bit integer values from CPU host-order to network-order.

inet_addr()

Convert a string of an IPv4 address in dotted-decimal notation to an IPv4 address in host-order.

inet_aton()

Convert an IPv4 address in ASCII dotted-decimal notation to a network protocol IPv4 address in network-order.

inet_ntoa()

Convert an IPv4 address in host-order into an IPv4 dotted-decimal notation ASCII string.

listen()

Set a socket to accept incoming connections.

ntohl()

Convert 32-bit integer values from network-order to CPU host-order.

ntohs()

Convert 16-bit integer values from network-order to CPU host-order.

recv() / recvfrom()

Copy up to a specified number of bytes received from a remote socket into an application memory buffer.

select()

Check if any sockets are ready for available read or write operations or error conditions.

send() / sendto()

Copy bytes from an application memory buffer into a socket to send to a remote socket.

sethostname()

Sets the host name with the given value in the character array.

setsockopt()

Set a specific option on a specific TCP socket.

shutdown()

Shut down a socket's send and/or receive operations.

socket()

Create a datagram (i.e., UDP) or stream (i.e., TCP) type socket.