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

Error correcting code - hamming code, Error Correcting Code - Hamming Code:...

Error Correcting Code - Hamming Code: Hamming code is the one of the error-correcting code named after its inventor. Because of the simplicity of the hamming code, it can dete

What is the network time protocol, What is the Network Time Protocol? ...

What is the Network Time Protocol? A protocol that makes sures accurate local timekeeping with reference to radio and atomic clocks located on the Internet. This protocol is c

Determine teh term - selection of computing infrastructure, Selection of co...

Selection of computing infrastructure The computing equipment on an Intranet must be selected in such a manner that they do not get obsolete very quickly or become too costly f

Define in details about computer networks, Define in details about compute...

Define in details about computer networks ? Discuss a variety of types of networks topologies in computer network. Also discuss a variety of costs and disadvantage of all topology

Advantages of vpns - point to point , Advantages of VPNs Advantages di...

Advantages of VPNs Advantages discussed in the following  section include those related to security. Consolidation transparency cost. And administration. a. Improved secur

Illustrate the term- search engine and surfing, Illustrate the term- Search...

Illustrate the term- Search Engine and Surfing Search Engine: Software used to find information on the Web. Examples are Google, Lycos and Yahoo. Server: A computer with

Quality of service - multiplicative decrease, Q. Quality of Service - multi...

Q. Quality of Service - multiplicative decrease? Quality of Service The collective consequence of service performance which determines the degree of satisfaction of a

Configure ip settings for the linksys wrt300n- ccna, Configure IP Settings ...

Configure IP Settings for the Linksys WRT300N The best way to understand the following settings is to think of the WRT300N as being same to a Cisco IOS-based router with two di

Networks - fundamental of network , Normal 0 false false fa...

Normal 0 false false false EN-IN X-NONE X-NONE Networks A networks  consists of two  or m

Logged into a router, You are logged into a router, what command would repr...

You are logged into a router, what command would represent you the IP addresses of routers linked to you? Ans)show cdp neighbors detail

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