Expand description
Socket API implementation
Provides BSD-style socket interface for TCP and UDP communication. Supports stream (TCP) and datagram (UDP) sockets with standard bind, listen, accept, connect, send, and receive operations.
Structs§
- Pending
Connection - Incoming connection for accept queue
- Socket
- Generic socket handle
- Socket
Options - Socket options
- Socket
Summary - Summary of a socket’s state for display purposes.
Enums§
- Socket
Domain - Socket domain (address family)
- Socket
Option - Socket option values
- Socket
Protocol - Socket protocol
- Socket
State - Socket state
- Socket
Type - Socket type
Functions§
- close_
socket - Close a socket by ID
- create_
socket - Create a new socket and return its ID
- getpeername
- Get the remote address of a connected socket.
- getsockname
- Get the local address of a socket.
- getsockopt
- Get a socket option.
- init
- Initialize socket subsystem
- list_
sockets - List all sockets with their current state.
- queue_
pending_ connection - Queue a new connection to a listening socket (called by TCP layer)
- recvfrom
- Receive data with sender address.
- sendto
- Send data to a specific address (for UDP sockets).
- setsockopt
- Set a socket option.
- with_
socket - Execute a closure with a socket by ID (immutable access)
- with_
socket_ mut - Execute a closure with a socket by ID (mutable access)