CSIE,NTUT,Taiwan1
Multiprotocol
Servers
Chuan-Ming Liu
Computer Science and Information Engineering
Spring 2004,NTUT
TAIWAN
CSIE,NTUT,Taiwan2
Introduction
Single thread for multiple transport
protocols
Motivation
Server design and process structure
An iterative example
Concurrent multiprotocol servers
CSIE,NTUT,Taiwan3
Motivation
Same service but with different transport
protocols,for example,DAYTIME
service can via TCP or UDP
Single protocol server is easy to maintain
but results in replication – same service
with different protocols may have the
same piece of code
Each single protocol server needs its own
resource – result in unnecessarily
consuming process table entries and
system resources
CSIE,NTUT,Taiwan4
Single Thread Multiprotocol
Use asynchronous I/O to handle communication
Initially,open two sockets,one for TCP and the
other is for UDP
Then,wait for one of the two sockets to be
ready
If TCP is ready,the server uses accept to make a
new connection
If UDP is ready,the server uses UDP service to
serve the client
CSIE,NTUT,Taiwan5
Process Structure
Server
OS
Application
Processes
Socket for
UDP
requests
Sockets for
a TCP
connections
Socket for
TCP
requests
CSIE,NTUT,Taiwan6
Multiprotocol DAYTIME
Server
Program daytimed.c
Shared code
Single procedure can be used by different
protocols
Easy to maintain
In the example,function daytime is the
shared code
CSIE,NTUT,Taiwan7
Concurrent Multiprotocol
Server
Why using iterative for DAYTIME server?
What we had learned for currency can be
also extended to implement multiprotocol
servers
More protocols and ports number can be
found in RFC 1700,http://www.cis.ohio-
state.edu/cgi-bin/rfc/rfc1700.html