
Concept explainers
- 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
- asks the user to enter a web server W’s name as a string www.name.suf (for example, www.ieee.org)
- prints the message “CLIENT START=” followed by C’s local system time CT1
- makes a TCP socket connection to the local server S listening on port 11211
- sends W’s name to S and waits to receive W’s page from S
- receives and displays the text of W’s page sent to it by S
- prints the message “CLIENT END=” followed by C’s local system time CT2
- prints the message “CLIENT DELAY=” followed by the value of CT=CT2-CT1 in milliseconds
- 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)
- listens for and accepts the connection from C on port 11211
- receives and prints the message “WEB SERVER=” followed by W’s name sent by C
- prints the message “IP ADDRESS=” followed by W’s IP address
- prints the message “SERVER START=” followed by S’s local system time ST1
- uses the class HttpURLConnection to connect to the web server W on port 443
- receives W’s page from the web server W
- prints the message “SERVER END=” followed by S’s local system time ST2
- prints the message “SERVER DELAY=” followed by the value of ST=ST2-ST1 in milliseconds
- sends to C the page received from the web server W
- sends to C the value of ST
- Run Wireshark (WS) and use the Firefox web browser to make a request to https://www.ieee.org. Stop the WS capture and save it in a .pcap file named F4 that WS itself can open. Find the frames in the WS capture that are needed to answer the questions below (click on parts of packets in the frames to get more information if needed). Submit a file F5 (named as above) that has all your answers.
2.1 Of the WS frames corresponding to the packets sent by the web server at http://www.ieee.org, choose any (ONE) WS frame that WS has labeled with Protocol=TCP that has Length=1514.
2.1.1 Indicate the WS frame number, and the source IP address and destination port number in this frame. Explain the significance of this specific IP address and this specific port number.
2.1.2 Indicate in order each protocol that appears in this frame and indicate the size of each of these protocol headers.
2.1.3 What is the value of the Total Length field in the IP header and what is the value of the size of the TCP segment data given by WS? Explain carefully the relation between these two values.
2.1.4 Using the actual hex values of the relevant bytes in this frame, explain the relation between the Sequence Number and Sequence Number (raw) in the TCP header.

Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

- 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
- what 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_forwardImplement a simple version of the linux cat command in C++. Use the system calls open(), get() and close(). cat - reads a file as specified by the user and prints its contents. A typical usage is as follows: If from my terminal y run ./cat main.cpp the contents of main.cpp. will be printed. Your program cat can be invoked with one or more files on the command line; it should just print out each file in turn. Example: [terminal]$ ./cat main.cpp main2.cpp #include <iostream>using namespace std;int main(){cout << "Hello, World!"; return 0;}#include <iostream>using namespace std;int main(){cout << "Programming is great fun!";return 0;} As you can see content of main.cpp was printed first and the content of main2.cpparrow_forwardHello. I need help developing a C or C++ program that simulate an 8-port Ethernet switch. The switch initially has no knowledge about the hosts connected to each port. It learns frame addresses and stores-and-forwards the frames. The input text file "in.txt" contains information of the incoming frames, one frame per line. There are 4 pieces of data per line: frame ID, arrival port, frame source address,and frame destination address. The frames arrive at the switch in the order of which they appearin the input file. Destination address "X" indicates a broadcast frame. Thank you! ********************PLEASE YOUR CODE MUST BE COMPLETE, COMPILE AND EXECUTE**************** The output text file "out.txt" has 8 lines. Each line lists all the frames departing from each port, here is an example: "in.txt" contains 5 incoming frames:F1 P2 B--AF2 P6 D--CF3 P5 E--BF4 P7 F--DF5 P6 D--X"out.txt" should list the departing frames on each port:P1: F1 F2 F5P2: F2 F3 F5P3: F1 F2 F5P4: F1 F2 F5P5: F1…arrow_forward
- I 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_forwardcan you do this in Java, please? Thank youarrow_forwardModify the above thread program so that you implement the interface Runnable. Make themain thread waiting till all other threads finish execution.arrow_forward
- Consider the BadReaderWriter.java program attached with this. The program has three threads, namely, one reader thread and two writer threads, and they all access the same list of numbers. The reader thread reads the list and prints it to the terminal. The writer threads append numbers to the list. At any point in time, if either of the writer threads finds that the list contains n elements, then it appends the number n + 1 to the list. Run this program, examine the output, and identify the problems.Fix these problems by implementing the acquireLock() and releaseLock() methods in the code.arrow_forwardCould you kindly utilize solely my code as I contributed to its development? I emphasize, please utilize only my code.I attached my code below label my code. The question that I need help with: You need to use the pthread for matrix multiplication. Each threadfrom 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 threads as needed. When allthe…arrow_forwardin java fx Write a program that launches 1,000 threads. Each thread adds 1 to a variable sum that initially is 0. You need to pass sum by reference to each thread. In order to pass it by reference, define an Integer wrapper object to hold sum. Run the program with and without synchronization to see its effect.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





