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

How l2f establishes the tunnel, Can you describe the broader steps of how L...

Can you describe the broader steps of how L2F establishes the tunnel?

Explain fiber-optics cable, Explain Fiber-Optics cable. A cable with ce...

Explain Fiber-Optics cable. A cable with central glass tube covered with protective shield which transmit data using photons is fiber optics cable. These cables transmit data t

What do you mean by platform independence, What do you mean by platform ind...

What do you mean by platform independence? Platform independence means that we can write and compile the java code in one platform (eg Windows) and can implement the class in a

Network performance & characteristics, There are two kinds of characteristi...

There are two kinds of characteristics in case of network performance. Delay Throughput

Explain short message service, Question: (a) Short Message Service (SM...

Question: (a) Short Message Service (SMS) is a service available on most mobile phones that allows the sending of short messages between mobile phones, other handheld devices

Public key cryptography and private key cryptography, Question: a) Di...

Question: a) Differentiate between the following key terms used in any e-banking security system: (i) Authorisation v/s Authentication. (ii) Data Integrity v/s Data Conf

Primary function - computer network, Primary Function Core network ty...

Primary Function Core network typically providing  the followings functionality 1.Aggregation : the  highest  level  of aggregation  in a service  provider  networks. The

Explain the different signal propagation behaviours, Question : (a) Lis...

Question : (a) List down and explain the different signal propagation behaviours that radio waves exhibit. (b) Explain the term Delay Spread with reference to signal propaga

Redhat, short note on redhat updation details? why redhat is popular?

short note on redhat updation details? why redhat is popular?

Bens network, Bens Network  Ben's network is a non-blocking network. ...

Bens Network  Ben's network is a non-blocking network.  It is a different  type of Clos network where initial and final stage consists of  2×2 switches (for n input  and m ou

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