Write a simple client-server network application

Assignment Help Computer Networking
Reference no: EM132640466

NET4005 Network Applications

Assignment - 1: Socket Programming and Concurrency

Objective:
Objective of this assignment is to write a simple client-server network application using Java socket programming API. Also, to learn simple concurrency control techniques in a multithreaded program.

Description:
You will write a client-server java program for transferring some file from the server to the client. The server and the client are separate programs and may be running on different computers.

The server program runs and waits for requests from the client. The client program takes a file name X as a command line parameter and asks the server if it has the file X. After receiving the request, the server checks if the file X is in its current directory and lets the client know. In addition, the server tells the client some statistics regarding the visits by all previous clients. Specifically, the server sends 2 numbers <N, M>, where N is the total number of requests so far and M is the number of successful requests. The statistics include the current request, and the server must update the statistics at every request. After the initial response, if the file was available the server sends the file to the client.

The client program displays three pieces of information it receives from the server - whether the file was found, and the two numbers M and N. If the file X was found then the client receives the file from the server and stores it in the current directory. After file transfer is complete, the client displays the message "file transfer complete" and terminates. The server program keeps running forever, and displays a log of current request (including client IP address and the requested file) and the statistics.

You must design the necessary protocol such that the information exchange between the client and the server works properly.

Implementation details:
Implement the client and the server as separate java programs, myfileclient.java and myfileserver.java, each having a main() method (you may have other classes in both the server and the client programs). The server must be able to handle concurrent requests from multiple clients, without holding requests for a long time. To do this, the server should handle the requests using a pool of worker threads. While there can be 100s of clients requesting files to the server, the server is restricted to have 10 worker threads only. After receiving requests from a client, the server will store this request in a queue. All the worker threads start running from the beginning. A worker thread can serve one client request at a time. Whenever a worker thread finishes serving a client request, it picks up the next available request from the queue and start serving that. Note that when multiple worker threads update the statistics M and N, you must be careful about having correct values.

User interface:
The client program is run as:
java myfileclient <server_IP> <server_port> <filename>
Output of the client program:
File <filename> [not] found at server
Server handled <N> requests, <M> requests were successful Downloading file <filename> // if the file found
Download complete // if the file found

The server program is run as:
java myfileserver
Output of the server program (for every request):
REQ <N>: File <X> requested from <IP> REQ <N>: [Not] Successful
REQ <N>: Total successful requests so far = <M> REQ <N>: File transfer complete

Attachment:- Socket Programming and Concurrency.rar

Reference no: EM132640466

Questions Cloud

Define ethical considerations when conducting research : Write a 700- to 1,050-word paper comparing the dual roles of scientist and practitioner that I/O psychologists play. Include the following in your response.
Write brief introduction to blockchain technology : Write brief introduction to "blockchain" technology and discuss how blockchain will affect the frequency and format of financial reporting
Provide the characteristics of assets : Question - Provide the 3 characteristics of assets and 3 characteristics of liabilities from SFAC No. 6 (as amended)
How things are going for as a community : Just Another Word for River from Allen's book Our Declaration,How are we to tell how things are going for us as a community? How can we see what course we're on
Write a simple client-server network application : Socket Programming and Concurrency - write a client-server java program for transferring some file from the server to the client
How social exchange theory relates to dialectic theory : Explain how social exchange theory relates to dialectic theory. how social exchange theory relates to social penetration theory?
Find the Notes Payable of Thorn : On October 1, 2017, Thorn Corporation purchased two (2) new company automobiles from Isuzu Corporation. Find the Notes Payable of Thorn
Although financial ratio analysis has limitations : Although Financial Ratio Analysis has limitations, it is a great tool to find the problematic areas in the company so that managers can go back
Discuss the difference between testing and assessment : Discuss the difference between testing and assessment. What does Evidence-based Best Practices have to do with testing and assessment in counseling?

Reviews

Write a Review

Computer Networking Questions & Answers

  What is the ethernet standard used in such a vlan

Explain in detail with the help of diagrams the CSMA/CD media access control technique used in Ethernet and write a report on your observations analyzing the data collected in previous step.

  Develop a matrix that identifies specific departmental needs

Develop a matrix that identifies specific departmental needs for a company that you are familiar with. Provide an overall total needed for the organization which will impact the ISP connection that will be needed, as well as equipment and software.

  Identify the osi model layer

The OSI model is a useful tool in troubleshooting a network because it enables you to isolate a problem to a particular software module or piece of hardware.

  Type of network provides limited access to corporate data

Which type of network provides customers with limited access to corporate data such as inventory, parts lists, and orders?

  Differences between lan and wan operating systems

What are the predominant network operating systems in use today? What are the differences between LAN and WAN operating systems

  Calculate the overall speedup of a system

How is a Network Layer protocol different from a Transport Layer protocol and into which Class of networks do the following IP Addresses fall?

  Explain a tcp connection between host a and host b

Is it possible for an application to enjoy reliable data transfer even when the application runs over UDP? If so, please be specific in your answer of how this takes place.

  . label the rows that make good power ciphers and explain

a) Make a power table for numbers mod 11. Indicate how the table shows Fermat's theorem, label the primitive roots mod 11. Explain how you can tell they are primitive roots. Label the rows that make good power ciphers and explain

  Create a presentation outlining the advantages for telestra

Create a presentation outlining the advantages for Telestra of using digital cellular handsets or cellular wireless cards. Determine the ability of the smaller

  What is the pair of sockets used in the given communication

A TFTP server residing on a host with IP address 130.45.12.7 sends a message to a TFTP client residing. What is the pair of sockets used in this communication?

  Comparison of the existing cellular networks generations

Evaluation of LTE/LTE-A Network Security - Wireless Networks and Security - Evaluate the LTE/LTE-A attacks on the access and core networks - Identify

  Rreserch on mans and metro ethernet

Rreserch on MANs and Metro Ethernet. write a short paper comparing metro Ethernet to other MAN alternatives that are available for business use

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