Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

port number

A number from 0 to 65535 that picks which program on a machine gets a network message.

A port distinguishes services on one host; an (IP address, port) pair is a SocketAddr. Binding port 0 asks the OS to choose a free one.

Examples

  • TcpListener::bind("127.0.0.1:0") asks the OS for any free port; binding a port that is already taken fails with ErrorKind::AddrInUse.

  • In "192.168.1.20:8080".parse::<SocketAddr>(), .ip() is 192.168.1.20 and .port() is 8080.

Read the full section →