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

Networking concepts, Networking Concepts Q1  What are the main feature...

Networking Concepts Q1  What are the main features of TCP connections? Why is it said that TCP provides full-duplex service? Q2  What are the differences between TCP conne

Bluej programming, i have been given a question:- any 50 numbers are given ...

i have been given a question:- any 50 numbers are given and to find out the 1)frequency of odd and even numbers 2)frequency of positive and negative numbers

Configure the management interface- spanning tree protocol, Configure the m...

Configure the management interface address on all three switches.  S1(config)#interface vlan1 S1(config-if)#ip address 172.17.10.1 255.255.255.0 S1(config-if)#no shutdown

Determine sonet devices, Sonet Devices STS Mux or DMux either multiplex...

Sonet Devices STS Mux or DMux either multiplexes signals from multiple sources into an STS or demultiplexes an STS into different destination signals. Regenerator is a repea

Disk encryption and block cipher, Suppose AES (or any block cipher) is used...

Suppose AES (or any block cipher) is used to encrypt data. Which mode of encryption covered in class is best suited for each of the following two scenarios and why? If more than on

Verify passwords - ccna, Verify Passwords Step 1 : Telnet to the route...

Verify Passwords Step 1 : Telnet to the router from Host2 and verify the Telnet password. You should be able to telnet to either Fast Ethernet interface of the router. I

What are the access methods used in lan, What are the Access methods used i...

What are the Access methods used in LAN: i. Switched access: It is used in LANs which are assigned around CBXs. Electronic switching is techniques are used to provide access

Illustrate 802.11b HR DSSS, 802.11b HR DSSS a) High-rate DSSS using a ...

802.11b HR DSSS a) High-rate DSSS using a 2.4 GHz band b) Similar to DSSS excluding for encoding method c) Uses complementary code keying (CCK), encoding 4 or 8 bits to

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