The following overview of the SOCKETS(BS2000) interface functions collects several functions together into task-oriented groups.
The three columns on the right, “INET”, “INET6”, and “ISO”, indicate the address family (AF_INET, AF_INET6, AF_ISO) in which the function involved is supported.
Setting up and shutting down connections on sockets
Function | Description | See | INET | INET6 | ISO |
socket() | Create socket | x | x | x | |
bind() | Assign a name to a socket | x | x | x | |
connect() | Initiate communication on a socket | x | x | x | |
listen() | Test socket for pending connections | x | x | x | |
accept() | Accept connection on a socket | x | x | x | |
shutdown() | Shut down connection in read and/or write direction | x | x | ||
soc_close() | Close socket | x | x | x |
Transferring data between two sockets
Function | Description | See | INET | INET6 | ISO |
soc_read(), | Receive a message from a socket via an established connection | "soc_read(), soc_readv() (read, readv) - receive a message from a socket" | x | x | x |
recv() | Receive a message from a socket via an established connection | x | x | x | |
recvfrom() | Receive a message from a socket | x | x | x | |
recvmsg() | Receive a message from a socket. | x | x | x | |
send() | Send a message from socket to socket via an established connection | x | x | x | |
sendto() | Send a message from socket to socket | x | x | x | |
sendmsg() | Send a message from socket to socket. | x | x | x | |
soc_write(), | Send a message from socket to socket via an established connection | "soc_write(), soc_writev() (write, writev) - send a message from socket to socket" | x | x | x |
select() | Multiplex input/output | x | x | x | |
soc_poll() | Multiplex input/output | x | x | x |
Transmitting data from/to the socket buffer
Function | Description | See | INET | INET6 | ISO |
soc_getc() | Get character from socket buffer | x | x | ||
soc_gets() | Get string from socket buffer | x | x | ||
soc_putc() | Put character in socket buffer | x | x | ||
soc_puts() | Put string in socket buffer | x | x | ||
soc_flush() | Flush socket buffer | x | x |
Receiving information about sockets
Function | Description | See | INET | INET6 | ISO |
getdtablesize() | Get size of descriptor table | x | x | x | |
getsockopt() | Get socket options | x | x | x | |
setsockopt() | Set socket options | x | x | x | |
getpeername() | Get name of communications partner | "getpeername() - get the remote address of the socket connection" | x | x | x |
getsockname() | Get name of socket | "getsockname() - get local address of the socket connection" | x | x | x |
Testing configuration values
Function | Description | See | INET | INET6 | ISO |
getaddrinfo() | Get IP address and port number corresponding to a host and/or service name | x | x | ||
gai_strerror() | Get description of a getaddrinfo() error code | "gai_strerror() - output text for the error code of getaddrinfo()" | x | x | |
getbcamhost() | Get name of BCAM host | x | |||
gethostname() | Get socket host name of current host | x | x | x | |
gethostbyaddr() | Get host name belonging to an IPv4 address | "gethostbyaddr(), gethostbyname() - get information about host names and addresses" | x | ||
gethostbyname() | Get IPv4 address belonging to a host name | "gethostbyaddr(), gethostbyname() - get information about host names and addresses" | x | ||
getipnodebyaddr() | Get host name belonging to an IPv4 or IPv6 address | "getipnodebyaddr(), getipnodebyname() - get information about host names and addresses" | x | x | |
getipnodebyname() | Get IPv4 or IPv6 address belonging to a host name | "getipnodebyaddr(), getipnodebyname() - get information about host names and addresses" | x | x | |
getnameinfo() | Get host and service name corresponding to IP address and port number | "getnameinfo() - get the name of the communications partner" | x | x | |
getservbyport() | Get name of a service | "getservbyname(), getservbyport() - get information about services" | x | x | |
getservbyname() | Get port number of a service | "getservbyname(), getservbyport() - get information about services" | x | x | |
getprotobyname() | Get number of a protocol | x | x | ||
if_nameindex() | List with interface names and index of local host | "if_nameindex() - list of interface names with the associated interface indexes" | x | x |
Manipulating Internet address
Function | Description | See | INET | INET6 | ISO |
inet_addr() | Convert character string from dotted notation to integer value (Internet address) | x | |||
inet_network() | Convert character string from dotted notation to integer value (subnetwork section) | x | |||
inet_makeaddr() | Create Internet address from subnetwork section and subnetwork local address section | x | |||
inet_lnaof() | Extract local network address in byte order of host from Internet host address | x | |||
inet_netof() | Extract network number in byte order of host from Internet host address | x | |||
inet_ntoa() | Convert Internet host address into a string conforming to normal Internet dotted notation | x | |||
inet_pton() | Converts
to the corresponding binary address. | x | x | ||
inet_ntop() | Converts a binary IPv4 or IPv6 address to the corresponding
| x | x |
Utility functions
Function | Description | See | INET | INET6 | ISO |
freeaddrinfo() | Release memory area for addrinfo structure requested by the getaddrinfo() function. | x | x | ||
freehostent() | Release memory area for hostent structure requested by the getipnodebyaddr() and getipnodebyname() functions. | x | x | ||
if_freenameindex() | Release memory area for array with if_nameindex() structure(s) requested by the if_nameindex() function. | "if_freenameindex() - release the dynamic storage occupied with if_nameindex()" | x | x | |
htonl() | 32 bit fields | x | |||
htons() | 16 bit fields | x | x | ||
if_indextoname() | Determine name corresponding to the index | "if_indextoname() - convert interface index to interface name" | x | x | |
if_nametoindex() | Determine name corresponding to the index | "if_nametoindex() - convert interface name to interface index" | x | x | |
ntohl() | 32 bit fields | x | |||
ntohs() | 16 bit fields | x | x |
Control functions
Function | Description | See | INET | INET6 | ISO |
soc_ioctl() | Control sockets | x | x | x | |
soc_wake() | Awaken a task waiting with select() or soc_poll() | "soc_wake() - awaken a task waiting with select() or soc-poll()" | x | x | x |
Test macros for AF_INET6
The following test macros are defined in <netinet.in.h>:
Macro | Test |
IN6_IS_ADDR_UNSPECIFIED | address = 0 ? |
IN6_IS_ADDR_LOOPBACK | address = loopback ? |
IN6_IS_ADDR_LINKLOCAL | address = IPv6 - LINKLOCAL ? |
IN6_IS_ADDR_SITELOCAL | address = IPv6 - SITELOCAL ? |
IN6_ADDR_V4COMPAT | address = IPv4-compatible ? |
IN6_ADDR_V4MAPPED | address = IPv4-mapped |
IN6_ARE_ADDR_EQUAL | address1 = address2 ? |