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