From: Maxwell Lol on
Barry Margolin <barmar(a)alum.mit.edu> writes:

> The parent process should be in a loop just calling accept() to get new
> connections on the original listening socket.
>
> The child processes should just be calling read() and write() on the
> connected socket that was returned by accept(). This is a different
> socket from the original listening socket.
>
> The OS differentiates them automatically for you.

The OS keeps track of each connection using four pieces of information

Server IP Address
Server Port
Client IP address
Client Port

The first three are identical. The client OS uses different ports when
connecting to the same server.

The OS uses this to send the packet to the right process.
First  |  Prev  | 
Pages: 1 2
Prev: AIX iconv question
Next: A couple of sed questions