Transcript Lecture 5
ICOM 6115 – Computer Networks
and the WWW
Manuel Rodriguez-Martinez, Ph.D.
Lecture 5
ICOM 6115
©Manuel Rodriguez-Martinez
Project 1: Simplet FTP Systems
• Implement a simple FTP client-server
system (Due: 11:59 PM-September 13,2002)
– You will write
• SFTPClient.java
– Main client application
• SFTPServer.java
– Main server application
• SFTPStub.java
– Client stub to interact with server
• SFTPHandler.java
– Server handler to manage all requests
ICOM 6115
©Manuel Rodriguez-Martinez
Lecture Objectives
• Understand Network Programming
– Operating Systems support for Networking
• threads
– Implementation options for servers
• Iterative servers
• Concurrent servers
– Buffering of I/O streams
– Finite state machines
– Protocols Design
ICOM 6115
©Manuel Rodriguez-Martinez
Options to implement a server
• Iterative Server
– One server instance serves all clients
• MyServer1.java
• Concurrent server
– Multiple server instances server the clients
• MyServer2.java
• Which one is best?
– As usual: it depends on what you want…
ICOM 6115
©Manuel Rodriguez-Martinez
Iterative Server
Client
Client
Client
Server
Listen Queue
OS
ICOM 6115
©Manuel Rodriguez-Martinez
Iterative Server
• One server to handle multiple requests
– Simple to implement
– Takes some time to service each request
• Becomes a bottleneck if heavy I/O is needed
– Should be used only to service small requests
• Time of day
– to synchronize all hosts on a network
• Name of a computer
– Typically used for connectionless services
• Datagrams (UDP)
ICOM 6115
©Manuel Rodriguez-Martinez
Concurrent Server
Client
Initial
Connection
Master
Server
Connection
Hand off
Slave
Server
Create slave
ICOM 6115
©Manuel Rodriguez-Martinez
Concurrency: Multiple Servers
Master
Server
ICOM 6115
Client
Client
Client
Slave
Server
Slave
Server
Slave
Server
©Manuel Rodriguez-Martinez
Concurrent Server
• Multiple serves to handle multiple requests
– Each client has its own server
• Master – slave relationship
– Master server: receives initial request and
forwards it to slaver server
– Slave server: the actual entity that interacts
with the client
• Requires OS support to be implemented
– Concurrent processes
– Threads
ICOM 6115
©Manuel Rodriguez-Martinez
Concurrent Server Issues
• Issues
– Far more complex to implement
– Provide parallelism
• Good for I/O intensive applications
– Should be used to service large requests
• FTP, HTTP
• Database requests
– Typically used by connection-oriented
services
• Streams (TCP)
ICOM 6115
©Manuel Rodriguez-Martinez
Example Concurrent Server
• MyServer2.java
• MyClient2.java
• Download from class web page
ICOM 6115
©Manuel Rodriguez-Martinez