Server
Design Alternatives
v client.c
Example Use:
% client
localhost
10123 5
500 4000
Means:
·
Connect to the server running at localhost
port 10123.
·
Forks 5 children.
·
Each child makes 500 TCP connections.
· Each connection sends the
string: "4000\n" and gets 4000 bytes from server.
v serv00.c (it uses web_child.c & pr_cpu_time.c)
To
test this server, we run only one client as:
% cd /home/cs779/stevens3rd.book/unpv13e/server
% serv00 10123
% client localhost
10123 1
5000 4000
When client is done, interrupt the
server:
^C
and it will print
user time = 0.134386, sys time = 1.58777
v serv01.c (it uses sig_chld_waitpid.c )
% serv01 10123
% client localhost 10123 5
500 4000
When client is done, interrupt the
server
^C
v serv02.c
(it uses child02.c )
% serv02 10123 3
/* 3 is the number of pre-forks /*
% client localhost 10123 5
500 4000
When
client is done, interrupt the server
^C
v serv06.c
% serv06 10123
% client localhost
10123 5 500 4000
When client is done, interrupt the
server
^C
v serv07.c
(it uses pthread07.c )
% serv07 10123 3
/* 3 is the number of pre-threads /*
% client localhost 10123 5
500 4000
When client is done, interrupt the
server
^C