You are here: Home > Specifications > Concurrency | ||
|
||
HomeDocumentationDownloadsSpecificationsCredits |
||
ConcurrencyThe figure below is an object diagram showing RftpServer handling multiple concurrent clients. Figure 1: Multiple Client Handling in RFTP In this diagram, data is being transferred over the data sockets and command sockets simultaneously to clients on two different machines. The classes working for client 1 are yellow; those for client 2 are blue. RftpServer, which serves all the clients, is left white. For simplicity, no file transfers are shown in this diagram. The RftpServer creates the command socket and waits (listens at port 2301) for clients to contact it. Then, when contacted by an RftpClient, the RftpServer creates an RftpHandler for the client. Note that the clients must be on different machines, because the ports 2301 and 2405 are used for each client, and it is the clients IP addresses that distinguish the sockets from each other. However, multiple clients can be served at the same time, each by their own RftpHandler and RftpDataServer. The RftpHandler for each client controls all communication with the client. Each RftpHandler creates the RftpDataServer to communicate with the clients RftpDataClient using the data socket. When the client quits the session, the RftpHandler and RftpDataServer for that client exit. RftpServer continues to run, waiting to be contacted by the next client. Figure 2 below expands upon Figure 1, showing how file transfers use the RftpTransferServer and RftpTransferClient classes. File transfers are done serially (one at a time) to a client. Each time the client requests a file transfer, the RftpClient creates an RftpTransferClient and the RftpHandler creates an RftpTransferServer to handle that file transfer. When the file transfer is complete, the RftpTransferClient and RftpTransferServer exit. Then another transfer could be initiated, and a new RftpTransferServer and a new RftpTransferClient would be started to perform that transfer. In Figure 2, client 1 has transferred one file, and is currently transferring a second file. RftpTransferClient1 and RftpTransferServer1 have exited, as indicated by their dotted lines in the diagram. Client 2 has not transferred any files in Figure 2. However, if client 2 requested a file transfer, its RftpHandler would perform it in the same way as shown for client 1. This can happen concurrently with the client 1 file transfer. Figure 2: Use of RftpTransferServer and RftpTransferClient in Concurrency |
||
|
||
You are here: Home > Specifications > Concurrency | ||