备注
AI Translation Notice
This document was automatically translated by hunyuan-turbos-latest
model, for reference only.
Source document: kernel/net/inet.md
Translation time: 2025-09-11 16:37:18
Translation model:
hunyuan-turbos-latest
Please report issues via Community Channel
Internet Protocol Socket
As is well known, the commonly used Inet Sockets are divided into TCP, UDP, and ICMP. For practical purposes, only TCP and UDP have been implemented so far.
The entire Inet network protocol stack interacts with the network card based on the smoltcp
crate.
Roadmap
TCP
Accept connections
Initiate connections
Half-duplex close
UDP
Transmit data
ICMP
ioctl
Misc
Lock handling for converting hardware interrupts to software interrupts (to avoid deadlocks)
epoll_item optimization
Optimize
inet port
resource management
TCP
Several state classes of the TCP Socket are defined according to the TCP state machine:
Init
: Raw stateUnbound
: State after creationBound
: State after binding an address
Listening
: Listening stateConnecting
: Connecting stateEstablished
: Connected state
UDP
UDP is connectionless, so there is no connection state. The UDP state only includes Unbound
and Bound
.
BoundInner
Another abstraction for the Inet Socket, used to handle the socket
bound to the network card, thereby encapsulating the smoltcp
interface and providing unified resource management.