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

Describe at one disadvantage of a peer to peer network, Describe at one dis...

Describe at one disadvantage of a peer to peer network. When you are accessing the resources that are shared by one of the workstations on the network, that workstation takes

A Comparative Study between MPLS VPN and the Public Internet, A Comparative...

A Comparative Study between MPLS VPN and the Public Internet which has intro. operation of tecnology, analysis, discussion, recommendation, conclusion.

What is redirector in networking, What is redirector in Networking? Red...

What is redirector in Networking? Redirector is software that intercepts file or prints I/O requests and changes them into network requests. This comes under presentation layer

Write the definition of ipx and udp, Write the definition of IPX and UDP ...

Write the definition of IPX and UDP IPX: Inter-network Packet Exchange supports the transport and network layers of the OSI network model. It provides fast, unreliable, communi

Calculate the modulation index and find the bandwidth, Consider a signal x(...

Consider a signal x(t) = 10 cos(2πfct + 4 cos 2πfmt). Assume frequency modulation. The message frequency fm = 2:3 kHz. Calculate the modulation index and find the bandwidth when

Show the tcp/ip and osi similarities, Q. Show the TCP/IP and OSI Similariti...

Q. Show the TCP/IP and OSI Similarities? TCP/IP and OSI Similarities - Both have Layers - Both have Application Layers - Have Comparable Transport and Network Layer

What is authentication, Q. What is Authentication ? - Verification of s...

Q. What is Authentication ? - Verification of sender's identity. - Accomplished through a digital signature, which is based on public key encryption/decryption. - Uses re

Describe some common threats to the hardware, Describe some common threats ...

Describe some common threats to the hardware Theft of a computer, printer, or other resources. Tampering by a disinterested or frustrated employee who takes every chan

Netware protocol provides link-state routing, Which NetWare protocol provid...

Which NetWare protocol provides link-state routing? Ans) NetWare Link Services Protocol (NLSP) gives link-state routing. SAP (Service Advertisement Protocol) advertises network

Tqm in design manufacturing, Quality assurance through statistical methods...

Quality assurance through statistical methods is a key component in a manufacturing organization where TQM generally starts by sampling a random selection selection of th

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