Client Server

[email protected]> ,/stream_client [email protected]> ,/stream_server

Connect to 192.168.1.20 Wait for connection on port 7777

Numeric: 335653056

Client: 192.168.1.10:3505 Send: 'HelloWorld' Numeric: 3232235786

Bytes received: 11

Bytes received: 11 Text: 'HelloWorld'

Text: 'HelloWorld'

Connection closed.

6Under Linux (and all other Unix flavors), all ports between 1 and 1,024 are referred to as reserved ports and may be used only by processes with root rights. For this reason, we use the free port number 7,777.

A 4-tuple notation (192.168.1.20:7777,192.168.1.10:350 6) is used to uniquely identify a connection. The first element specifies the address and port of the local system, the second the address and port of the client.

An asterisk (*) is substituted if one of the elements is still undefined. A server process listening on a passive socket but not yet connected to a client is therefore denoted by 192.168.1.20:7777, *.*.

Two socket pairs are registered in the kernel once a server has duplicated itself with fork to handle a connection.

Continue reading here: Listen Established

Was this article helpful?

0 0