Multiprotocol Servers Chuan-Ming Liu Computer Science and Information Engineering Spring 2004, NTUt TAIWAN CSIE NTUT Taiwan
1 CSIE, NTUT, Taiwan Multiprotocol Servers Chuan-Ming Liu Computer Science and Information Engineering Spring 2004, NTUT TAIWAN
●●。 Introduction o Single thread for multiple transport protocols o Motivation o Server design and process structure o An iterative example o Concurrent multiprotocol servers SIE NTUT. Taiwan
2 CSIE, NTUT, Taiwan Introduction Single thread for multiple transport protocols Motivation Server design and process structure An iterative example Concurrent multiprotocol servers
●● Motivation o 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 o Ea ach single protocol server needs its own resource -result in unnecessarily consuming process table entries and system resources SIE NTUT. Taiwan
3 CSIE, NTUT, Taiwan 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
o Single Thread Multiprotocol o Use asynchronous I/o to handle communication o Initially, open two sockets: one for tCP and the other is for UDP o Then wait for one of the two sockets to be rea e If TCP is ready the server uses accept to make a new connection o If udP is ready, the server uses UDP service to serve the client 4 SIE NTUT. Taiwan
4 CSIE, NTUT, Taiwan 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
●●。 Process structure Server Application rocesses Socket for Socket for Sockets for+OS UDP CP a TcP requests requests connections 5 SIE NTUT. Taiwan
5 CSIE, NTUT, Taiwan Process Structure Server OS Application Processes Socket for UDP requests Sockets for a TCP connections Socket for TCP requests
MultiprotOcol DAYTIME ●●● Server o Program daytime.C o Shared code o Single procedure can be used by different protocols ● easy to maintain o In the example function daytime is the Shared code 6 SIE, NTUT, Taiwan
6 CSIE, NTUT, Taiwan 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
●●● Concurrent Multiprotocol Server o Why using iterative for DAYTIME server o What we had learned for currency can be also extended to implement multiprotocol servers o More protocols and ports number can be foundinrfc1700.http://www.cis.ohio state. edu/cgi-bin/rfc/rfcl700html SIE NTUT. Taiwan
7 CSIE, NTUT, Taiwan 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.ohiostate.edu/cgi-bin/rfc/rfc1700.html