Approach for client - server communication, Computer Networking

Assignment Help:

Client

Once the GUI application is loaded, it will send a request (instance/object of Commands class) to server for a list of files from the server's shared directory.Client will write Commands object to ObjectOutputstream. Commands class has to implement Serializable interface as this will be transferred over the network. Commands class will have following value:
- nextCommand value in Commands object will be set to COMMAND_SEND_FILE_LIST
Server

Upon receiving the file list request, the server will read all the files (no directory) in the server's shared directory and wrap each file name and corresponding size in FileInfo object. DirInfo object will have a variable named fileList with type of List(implementation ArrayList). Server will write DirInfo object to socket's ObjectOuputStream so that client can read it from ObjectInputStream.DirInfo and FileInfoclass have to implement Serializable interface as these will be transferred over the network.

Client

Client will read DirInfo object from ObjectInputStream and populate the JList on "Remote File List" panelwith file names. At the same time, each fileName and corresponding fileSize should be saved in a HashMap.Once the JList is loaded and the user double clicks a file name in the JList, client will send a Commands object to server (by writing to ObjectOutputstream) with following values:
- nextCommand value in Commands object will be set to COMMAND_SEND_FILE
- fileName should be set with the double-clicked file name from the JList


Server

Upon receiving send file request (will read Commands object from ObjectInputStream), the server will read the nextCoomand and fileName from Commands object and start transferring the file bytes to client by writing to OutputStream (Could be wrapped into a BufferedOutputStream for efficiency).

Client

Client will read file binaries from InputStream(not ObjectInputStream) and finish reading when number of bytes read is length of the corresponding file name. The file length can be derived by passing the fileName to HashMap where file length was stored earlier while populating the JList based on DirInfo object received from server. Once the file content is read it will be then saved in the download directory on client machine.


Related Discussions:- Approach for client - server communication

Factor price, who are experts who lecter on factor price?

who are experts who lecter on factor price?

IPV6, is DVMRP multicast prtocol supports IPV6?

is DVMRP multicast prtocol supports IPV6?

Prepare network schema of a company, Your Case Study must be based on the i...

Your Case Study must be based on the information provided. There will be no additional information. This must be submitted in a .doc, or .pdf format. If you send a few paragraphs i

Explain FDDI media access control, FDDI Media Access Control Unlike CSM...

FDDI Media Access Control Unlike CSMA/CD networks such like Ethernet token-passing networks are deterministic--you are able to calculate the maximum time that will pass before

Write the purpose of split horizon, Split Horizon - If you attain a protoc...

Split Horizon - If you attain a protocol's route on an interface, do not send information about that route back out that interface.

TRAFFIC CONGESTION ASSESSMENT, Can I get help for traffic congestion anlysi...

Can I get help for traffic congestion anlysis using GIS

What is silly window syndrome, What is silly window syndrome? It is a d...

What is silly window syndrome? It is a difficulty that can ruin TCP performance. This problem happens when data are passed to the sending TCP entity in large blocks, but an int

Bandwidth allocation , Consider figure.  Assume a new flow E is added that ...

Consider figure.  Assume a new flow E is added that takes a path from R1 to R2 to R6. How does the max-min bandwidth allocation change for the 5 flows?

What is extranet and intranet, Extranet and Intranet An Extranet is a t...

Extranet and Intranet An Extranet is a type of Intranet (Internal TCP/IP Network) that has been selectively opened to a firm's suppliers, customers. Intranet An intrane

Define layered network model, Q. Define layered network model? - The OS...

Q. Define layered network model? - The OSI Reference Model is collection of seven layers every specifying particular network functions. - The process of breaking up the func

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd