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

  Networking and types of networking

This assignment explains the networking features, different kinds of networks and also how they are arranged.

  National and Global economic environment and ICICI Bank

While working in an economy, it has a separate identity but cannot operate insolently.

  Ssh or openssh server services

Write about SSH or OpenSSH server services discussion questions

  Network simulation

Network simulation on Hierarchical Network Rerouting against wormhole attacks

  Small internet works

Prepare a network simulation

  Solidify the concepts of client/server computing

One-way to solidify the concepts of client/server computing and interprocess communication is to develop the requirements for a computer game which plays "Rock, Paper, Scissors" using these techniques.

  Identify the various costs associated with the deployment

Identify the various costs associated with the deployment, operation and maintenance of a mobile-access system. Identify the benefits to the various categories of user, arising from the addition of a mobile-access facility.

  Describe how the modern view of customer service

Describe how the greater reach of telecommunication networks today affects the security of resources which an organisation provides for its employees and customers.

  Technology in improving the relationship building process

Discuss the role of Technology in improving the relationship building process Do you think that the setting of a PR department may be helpful for the ISP provider? Why?

  Remote access networks and vpns

safekeeping posture of enterprise (venture) wired and wireless LANs (WLANs), steps listed in OWASP, Securing User Services, IPV4 ip address, IPV6 address format, V4 address, VPN, Deploying Voice over IP, Remote Management of Applications and Ser..

  Dns

problems of IPV, DNS server software, TCP SYN attack, Ping of Death, Land attack, Teardrop attack, Smurf attack, Fraggle attack

  Outline the difference between an intranet and an extranet

Outline the difference between an intranet and an extranet A programmer is trying to produce an applet with the display shown in Figure 1 below such that whenever one of the checkboxes is selected the label changes to indicate correctly what has..

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