
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question

Transcribed Image Text:Write a Java TCP socket program consisting of one client C and one local server S (localhost). Code for the client
and server should be separate and contained in the respective files F1 and F2 above. Modify and use the code in the
files posted on Blackboard: TCPWebClient18.java and TCPKRClient.java for the client C and TCPKRServer.java
for the server S. Since we are testing behavior with no threads, the code should not have threads.
Do not use System.exit() in your code. Submit your socket code in the files F1 and F2 (named as above). All the
code needed should be in these two files. Include a comment at the top of each file that says how you compiled and
ran the code. Capture screenshots with client and server screens during an example run and put them in the file F3.
The client C
1.1 asks the user to enter a web server W's name as a string www.name.suf (for example, www.ieee.org)
1.2 prints the message "CLIENT START=" followed by C's local system time CT1
1.3 makes a TCP socket connection to the local server S listening on port 11211
1.4 sends W's name to S and waits to receive W's page from S
1.5 receives and displays the text of W's page sent to it by S
1.6 prints the message "CLIENT END=" followed by C's local system time CT2
1.7 prints the message "CLIENT DELAY=" followed by the value of CT=CT2-CT1 in milliseconds
1.8 prints the message "ROUNDTRIP TIME=" followed by the value of RT=CT-ST in milliseconds, where ST is
the value of server delay sent to it by S.
The local server S (localhost)
1.9 listens for and accepts the connection from C on port 11211
1.10 receives and prints the message "WEB SERVER=" followed by W's name sent by C
1.11prints the message "IP ADDRESS=" followed by W's IP address
1.12 prints the message "SERVER START=" followed by S's local system time ST1
1.13 uses the class HttpURLConnection to connect to the web server W on port 443
1.14 receives W's page from the web server W
1.15prints the message "SERVER END=" followed by S's local system time ST2
1.16 prints the message "SERVER DELAY=" followed by the value of ST=ST2-ST1 in milliseconds
1.17 sends to C the page received from the web server W
1.18 sends to C the value of ST
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

Knowledge Booster
Similar questions
- Could you kindly utilize solely my code as I contributed to its development? I emphasize, please utilize only my code. This code has to be in C code and I have provided part of code below. Question that I need help with: You need to use the pthread for matrix multiplication. Each thread from the threadpool should be responsible for computing only a partof the multiplication (partial product as shown in the above picture –all Ti(S) are called a partical product). Your main thread should splitthe matrices accordingly and create the partial data arrays that areneeded to compute each Ti. You must create a unique task with thedata and submit it to the job queue. You can compute the partialproducts concurrently as long as you have threads available in thethreadpool. You have to remove the task the from queue and submitto a thread in the threadpool. You should define the number ofthreads to be 5 and keep it dynamic so that we can test the samecode with a higher or lower number of…arrow_forwardQ :For instance, what happens if a client connects to SimpleWebServer, and sends a carriage return as its first message instead of sending a properly formatted GET message? SimpleWebServer would crash! How would better requirements have potentially eliminated this problem? Requirements could have been written for the SimpleWebServer program that specifies how it should behave in corner cases. Your suggestion to fix the issue in this case is highly appreciated.arrow_forwardIn C Programming Add a new built-in path command that allows users to show the current pathname list, append one pathname, or remove one pathname. In your shell implementation, you may keep a data structure to deal with the pathname list. If you do not use execle() or execve() that allows you to execute with your own environment variables, you will need to add it to the “real” PATH environment variable for executables in the path to work correctly. The initial value of path within your shell shall be the pathname list contained in the PATH environment variable. Implement the path command as follows: • path (without arguments) displays the pathnames currently set. It should show pathnames separated by colons. For example, "/bin:/user/bin". • path + ./bin appends the pathname to the path variable. You may assume that only one pathname is added at a time. • path - ./bin removes the pathname to the path variable. You may assume that only one pathname is removed at a time. You may assume…arrow_forward
- Write a class that extends thread, called clientEng, to implement the following part of client protocol 1- The client thread sends an integer number, let us assume it is N, to the server. 2- The server iterates from 1 to 10 to send 10 values that results from multiplying N by the iteration index. 2- The client gets into a loop that iterates 10 times to receive the 10 values. 3- In each iteration the client prints on the screen a message as "N * M =value ", where M is the number of iteration from 0 to 10 and value is the received value. 4- after the last iteration the client should sends a 'done message from the server. 5- The client receives "OK message from the server and closes the socket. Do not write any other code, other than the thread class, but Add a line that allows for creating the running the code of clientEng.arrow_forwardhow can I write a client program that send 10 one after the other by a thread and by user. and the server recieves the 10 messages and write a different 10 messages.arrow_forwardHello, could you assist me with this code? I'm encountering difficulties and I'm unsure how to proceed. The code needs to be written in C. I've included my current code below for reference.question:You need to use the pthread for matrix multiplication. Each thread from the threadpool should be responsible for computing only a part of the multiplication (partial product as shown in the above picture –all Ti(S) are called a partical product). Your main thread should split the matrices accordingly and create the partial data arrays that are needed to compute each Ti. You must create a unique task with thedata and submit it to the job queue. You can compute the partial products concurrently as long as you have threads available in the threadpool. You have to remove the task the from queue and submitto a thread in the threadpool. You should define the number of threads to be 5 and keep it dynamic so that we can test the same code with a higher or lower number of threads as needed. When…arrow_forward
- Need help with coding in Java. Just create the server. In this part, you will implement a Server class that will accept only one connection, process its requests, and then the Server will end. Create a Server class in the package edu.ucdenver.server The constructor should take the port and backlog to open the server. The server should implement the Runnable interface. Override the following public methods: public void run() This will implement your server. Similar to runServer() from our lecture examples. Upon a client connection, the server will listen for requests. Once one is received, will be processed (see below) and the response will be send to the server. Keep accepting requests until the client disconnect. No termination message will be send, the client will just disconnect. Protocol: the communication will be text based. fields will be delimited by a vertical bar ( | ) clients may send either two requests: "E|text" -> requesting the server to encode the…arrow_forwardwhat is the difference between path and classpath in java? explain with one example, and say the syntax to set path and classpath in mac?arrow_forwardI have my code below and I am stuck at the last part which is the display of the thread that finished first and last. There are times when it give the correct output and sometimes it is not. How can it be fixed? The sample output is given below and the output I made. import java.util.Random;import java.util.Scanner; class prog1 implements Runnable { private String cName = new String(""); private int x; public int c1 = 0, c2 = 0, c3 = 0; // static array to store which thread closed first public static int [] order = new int[3]; // index of array private static int index = 0; public prog1 (String cName, int x){ this.cName = cName; this.x = x; } @Override public void run(){ Random r = new Random(); int randNum; for (int i = 1; i <= this.x; i++){ randNum = r.nextInt(x) + 1; if(i == this.x) { // put the number // get number from name's last character of thread…arrow_forward
- Modify the above thread program so that you implement the interface Runnable. Make themain thread waiting till all other threads finish execution.arrow_forwardAllow the user to enter the internet address (URL) and programming language of the web store.arrow_forwardUsing 'import threading' and 'import socket' create a simple and functional Python chat application. Provide an example by creating a server.py and client.py class that allows two clients to connect to one server. Please create your own code and not copied from past questions. As someone whose still brand new to Python, include comments and screenshots. Try to have the code run in the command prompt. Server can allow the clients to input their own usernames. Once the server receives the message from a client, it will forward the message to the intended client and vice-versa. A client can disconnect from the server by sending “.exit” message anytime. Server upon receiving “.exit” message from the client, will close the connection with it.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY