Skip to main content

Module net

Module net 

Source
Expand description

Socket, UNIX domain, and Virtio-Vsock syscall wrappers.

Structs§

In6Addr
IPv6 address (struct in6_addr) in network byte order.
InAddr
IPv4 address (struct in_addr) in network byte order.
SockAddrIn
Kernel sockaddr_in structure for AF_INET sockets.
SockAddrIn6
Kernel sockaddr_in6 structure for AF_INET6 sockets.
SockAddrStorage
Generic socket address storage (struct sockaddr_storage, 128 bytes).
SockAddrUn
Kernel sockaddr_un structure for UNIX domain sockets.
SockAddrVm
Kernel sockaddr_vm structure for AF_VSOCK sockets.

Constants§

AF_INET
IPv4 Internet protocols address family.
AF_INET6
IPv6 Internet protocols address family.
AF_UNIX
Unix domain sockets address family.
AF_UNSPEC
Unspecified address family.
AF_VSOCK
Virtio vsock address family.
IPPROTO_ICMP
Internet Control Message Protocol.
IPPROTO_IP
Dummy protocol for TCP / IP level.
IPPROTO_IPV6
IPv6 header protocol level.
IPPROTO_TCP
Transmission Control Protocol.
IPPROTO_UDP
User Datagram Protocol.
IPV6_V6ONLY
Restrict AF_INET6 socket to IPv6 communications only (IPPROTO_IPV6).
MSG_DONTWAIT
Nonblocking I/O for a single send/recv call.
MSG_NOSIGNAL
Do not generate SIGPIPE on peer close.
MSG_WAITALL
Wait for full request or error.
SHUT_RD
Shut down the reading side of a socket.
SHUT_RDWR
Shut down both reading and writing sides of a socket.
SHUT_WR
Shut down the writing side of a socket.
SOCK_CLOEXEC
Set close-on-exec (FD_CLOEXEC) on the new descriptor.
SOCK_DGRAM
Connectionless, unreliable datagrams.
SOCK_NONBLOCK
Set O_NONBLOCK on the new open file description.
SOCK_STREAM
Sequenced, reliable, two-way connection-based byte streams.
SOL_SOCKET
Socket level for getsockopt / setsockopt.
SO_ERROR
Get and clear pending socket error.
SO_KEEPALIVE
Enable keep-alive messages on connection-oriented sockets.
SO_RCVBUF
Receive buffer size (SOL_SOCKET).
SO_RCVTIMEO
Receive timeout option.
SO_REUSEADDR
Allow reuse of local addresses.
SO_REUSEPORT
Allow multiple sockets to bind to the same port (SOL_SOCKET).
SO_SNDBUF
Send buffer size (SOL_SOCKET).
SO_SNDTIMEO
Send timeout option.
TCP_KEEPCNT
Number of keepalives before death (IPPROTO_TCP).
TCP_KEEPIDLE
Start keepalives after this period (IPPROTO_TCP).
TCP_KEEPINTVL
Interval between keepalives (IPPROTO_TCP).
TCP_NODELAY
Disable Nagle’s algorithm (IPPROTO_TCP).
VMADDR_CID_ANY
Wildcard vsock context ID.
VMADDR_CID_HOST
Host hypervisor vsock context ID.
VMADDR_CID_LOCAL
Local loopback vsock context ID.

Functions§

accept
Accepts a connection on fd without peer address capture.
accept4
Accepts a connection on fd with flags (SOCK_NONBLOCK, SOCK_CLOEXEC) without peer address capture.
accept4_raw⚠
Accepts a connection on fd with flags, optionally writing the peer address into addr.
accept_in
Accepts an AF_INET connection on fd with flags, returning (client_fd, peer_addr).
accept_in6
Accepts an AF_INET6 connection on fd with flags, returning (client_fd, peer_addr).
bind_in
Binds an AF_INET socket fd to addr.
bind_in6
Binds an AF_INET6 socket fd to addr.
bind_raw⚠
Binds fd to the raw socket address [addr..addr + addrlen].
bind_unix
Binds an AF_UNIX socket fd to path.
bind_vsock
Binds an AF_VSOCK socket fd to addr.
connect_in
Connects an AF_INET socket fd to addr.
connect_in6
Connects an AF_INET6 socket fd to addr.
connect_raw⚠
Connects fd to the raw socket address [addr..addr + addrlen].
connect_unix
Connects an AF_UNIX socket fd to path.
connect_vsock
Connects an AF_VSOCK socket fd to addr.
get_so_error
Queries and clears any pending SO_ERROR on fd.
getpeername_raw⚠
Queries the peer address connected to fd.
getsockname_in
Queries the local AF_INET address bound to fd.
getsockname_in6
Queries the local AF_INET6 address bound to fd.
getsockname_raw⚠
Queries the local address bound to fd.
getsockopt_raw⚠
Gets a raw socket option from fd.
listen
Marks fd as a passive socket with maximum pending connection queue backlog.
recv
Receives bytes into buf from socket fd with flags.
recv_raw⚠
Receives up to len bytes into buf from socket fd with flags.
recvfrom_in
Receives a datagram into buf on AF_INET socket fd with flags, returning (bytes_read, src_addr).
recvfrom_in6
Receives a datagram into buf on AF_INET6 socket fd with flags, returning (bytes_read, src_addr).
send
Sends buf on connected socket fd with flags.
send_raw⚠
Sends len bytes from buf on connected socket fd with flags.
sendto_in
Sends buf to an AF_INET destination addr on socket fd with flags.
sendto_in6
Sends buf to an AF_INET6 destination addr on socket fd with flags.
set_tcp_nodelay
Enables or disables TCP_NODELAY on fd.
setsockopt_raw⚠
Sets a raw socket option on fd.
shutdown
Shuts down part or all of a full-duplex connection on fd.
socket
Creates an endpoint for communication and returns its file descriptor.
socketpair
Creates an unnamed pair of connected sockets.