Algorithms and Issues in Client-Server Design
Algorithms and Issues in Client-Server Design
slide 1 gaius
gaius
overview of a server
many ways that a client/server can be designed
slide 3 slide 4
gaius gaius
however most programmers choose concurrent server servers that use TCP are, by definition, connection
implementations as iterative servers oriented
cause unnecessary delays in distributed
applications those that use UDP are connectionless servers
may be a performance bottleneck that effects
many client applications
should also examine the application protocol
because an application protocol designed to use a
Iterative server implementations, which are easier to connection oriented protocol might perform
build and understand, may result in poor incorrectly or inefficiently when using a
performance because they make clients wait for connectionless protocol
service. Whereas in contrast, concurrent server why?
implementations, which are more difficult to build,
yield better performance.
slide 7 slide 8
gaius gaius
Comments on algorithm
create a socket and bind
to the well known address
of the service being offered. a less common server
used for services that require a trivial amount of
put socket into passive mode, making it processing
ready for use by a server it might incur a high overhead in establishing
and terminating connections
loop
accept the next connection
request from the socket,
and obtain a new socket
for the connection
repeat
read a request from
the client,
generate a reply,
send the reply
back to the client
until finished with the client ;
close connection
end
slide 9 slide 10
gaius gaius
getportbyname accept
use this function to map a particular service onto use this function to obtain the next incoming
a well known port number connection request
need to ensure that our application port number returns the new descriptor of a socket which can
does not conflict with someone else application then be used by read and write
in UNIX all port numbers are defined in
/etc/services close
to close the connection with the client the server
bind uses close.
use this function to bind a socket to a port
number and the servers IP address
listen
the server uses this function to place a socket
into passive mode
it also takes an argument which specifies the
length of request queue for this socket
slide 11
gaius
loop
read next request from client
process the request
send reply back to client
end
sendto
use this function to send data across a primary reason for introducing concurrency
connectionless socket provide faster response time to multiple clients
slide 15 slide 16
gaius gaius
slide 19 slide 20
gaius gaius