|
ACCEPT - suspend server until request.
When client request arrives: ACCEPT returns.
Start new socket (thread
or process)
with same properties as original, this handles the request,
server goes on waiting on original socket.
If new request arrives while spawning thread for this one,
it is queued.
If queue full it is refused.
Both sides can now SEND, RECEIVE.
Connection not released until both sides do CLOSE. Typically client does it, server acks.
IP address = Address of a host.
IP address + port = Address of a process (service) on a host.
List of ports.
1 to 65535 (16 bit no).
Ports set aside for some
"well-known"
services:
Full list:
Server machine may run multiple server processes,
each contactable on different port.
Conversely,
multiple clients may want to contact same port (e.g. Web server).
Client creates socket at its end.
Sends request to server (at port no).
Server creates socket at its end dedicated to that client.
One port: Many sockets to that port.
Infinite loop.
Can only be stopped by external kill (end process).
ACCEPT returns - client has connected.
Can both read from and write to the
"socket address" sa.
Client sends the file name it wants.
Server writes the file to the socket and then closes the socket.
Back to infinite loop:
ACCEPT - suspend waiting for next request.
Usage:
returns file contents to stdout.$ client host filename
On Internet since 1987.