IMG_0148
.jpeg
keyboard_arrow_up
School
University of Windsor *
*We aren’t endorsed by this school
Course
1
Subject
Computer Science
Date
Jan 9, 2024
Type
jpeg
Pages
1
Uploaded by DeanRat199
CLsk . PP C I IS IIEOOUET. PT S WU & LT IS 1 ELCE VST $0 WEYE VT 18U j) Why does the “ return a new socket for each received connection? To facilitate assigning each connection to a new child, avoid using a single socket for all connections. Otherwise, one connection at a time can be replied when using a single socket. Question 3: [5 marks] (Easy) Find the problem with the /ogic of below program, assuming all system calls are successful. The problem is not about compile or run tlme errors! et " child writes 1 to 10 to the file in order like 1,2,3,...9, 1,2,3,...,9, ....
However, the Kernel mj 3 Of 4 in middle of writing of a child and give it to another child. So, in the file we may end up s like 1,2,1,2,3,3,4,4,5,6, ... pipe (fd) ; for(int 1+ = 0; 1 < 10: 41){ int childpid = fork(); if (childpid == 0){ close (fd[0]); for(int j = 0; j < 10; ++j) write(fd[1], j, sizeof(int)):; exit (0); Question 4: [20 marks: 10 marks for each item] (Moderate) Find the problem with the logic of below programs, assuming all the system calls are successful. Propose fixes. The problem has nothing to do with compile or run time error. a) int childpid = fork():; if (childpid == 0) { system(cc main.c -o main); exit (0); } else if (childpid > 0) { system(./main); exit (0); } The parent process is expected to run the program after the child builds the program. But if the Kernel gives the processor to the parent first, it wants to run a program that does not exist yet! To fix, we can add in the parent before running the program m to make sure that the child finishes first. b) int server sd = socket(...); bind(server_sd, ...); listen(server sd, 5) < 0); while (1) { result = accept (server sd, ...): recv(result, client_msg ,100 , 0)) < 0); sscanf (client msg,"%s %s %d %d", user , psw, &x , &y); if ((strcmp (user, "comp2560") == 0) && (strcmp(psw, "£2022") == 0) ){ pid_t child_pid = fork(); if (child_pid == 0) add_and_send (result, x, y); } } The Server process is doing the m and then does the authentication. So, it becomes busy with the first client receiving information and cannot proceed with receiving the calls of other clients! What if the client simply do not send any info or the client is very slow?! To fix, we can ask the child to do the authentication. We can mow right after the _. Then, the Server continue with another iteration and does another not waiting for any client at all. Question 5: [20 marks] (Moderate) [Upload a File] Mohammad asks the students of his lab section to send their face/head shots. He wants to design a client-server architecture in which the students run a client program to upload their photos and the server collects the photos and save them in a folder. What would be the steps of his design in the client program and The Server program? 1) Mohammad writes The Server and runs it on his computer in the network. It accepts calls from clients. 2) Mohammad also writes a client program that a. accept a path to the photo file and Studentld as arguments to the program b. connects to The Server when it runs on a computer in the network (Because Mohammad is the programmer of the client, he knows The Server’s IP:Port to which the clients should connect!) c. sends the Studentld to the Server d. reads n bytes from the photo file and send it to The Server. e. does (d) until there is no more bytes in the photo file. Then it sends 'END’ to The Server Optionally, Mohammad can create a child in the client program to do the sending. Then the parent can report the progress to the student how many bytes have sent and how many remined so far. 3) When receiving the i-th call from a client, The Server creates i-th child 4) The i-th child receive the Studentld and create a file with the name of the Studentld S) The i-th child writes the bytes of photo file to the file as it receives them in a while loop until ‘END’ 6) When i-th child receives 'END’, closes the file, and exits. 7) The Server continues to accept calls from clients. Question 6: [10 marks] (Moderate) [Online C Compiler'?] The latest standard for C language is ISO/IEC 9899:2018, widely known as C17 and released June 2018. Hamed wanted to build his program using the latest standard, but he needed to 1) download a compiler that is C17-compliant, 2) install it on his computer, 3) build his program. He did all these steps, each of which had many challenges. Suddenly, he got the idea of exposing his installed C17-compliant compiler to all programmers for free, alleviating the three steps. What would be the steps of his design? (Hints: Lab07 + Labl1) 1) Hamed writes The Server which accepts text body of C programs from clients. 2) For each received C program, The Server creates a child 3) The child writes the C program into a file at The ?cl ver's (mnpurw named_ 4) The child builds the file using EjgeRa=ull ./main. 2in”) 5) The child returns the -pmm am file to the client Question 7: [S marks| (Easy, Cool Down
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
(please type answer fast.)
arrow_forward
1) Describe briefly the main technical steps involved in setting up a network server in Java via TCP/IP.
2) Describe briefly the main technical steps involved in setting up a network client in Java via TCP/IP.
The only information I have so far is that the server listens to a specific port, waits for connection requests from a client and establishes dedicated connection at an assigned port
bound with a socket. The client talks to the server via its dedicated socket.
arrow_forward
i have answered B in this question, but i am not sure if it is correct ? if not which one is ? thank you :)
arrow_forward
- Q4/Assume a system of 40 cells with a cell radius of 1 km, a total frequency
bandwidth that supports 500 traffic channels, and a reuse factor of N= 4.
- (a) If there are 40 total cells, what geographic area is covered, how many channels
are there per cell, and what is the total number of concurrent calls that can be
handled?
arrow_forward
q9c- Context- Alice and Bob are members of the same Kerberos realm. They are both currently logged in with active session keys from the Kerberos KDC (key distribution centre). As per the Kerberos standard, the KDC has created unique session keys for both Alice and Bob, and then discarded them once received by the respective users. Alice wants to access a resource owned by Bob and contacts the KDC to request the necessary material. Answer the following questions about this scenario:
Q- When Bob receives the service ticket from Alice, why should he trust her and what guarantees the service ticket is genuine and wasn’t forged by Alice?
arrow_forward
4. [Socket] What is a socket? Suppose a process in Host C has a UDP socket with port number6789. Suppose both Host A and Host B send a UDP segment to Host C with destination portnumber 6789. Will both segments be directed to the same socket at Host C? If so, how will theprocess at Host C know that these two segments originated from two different hosts?
5. [Demultiplex] Define multiplexing and demultiplexing. Briefly explain how TCP demultiplexing isdifferent than UDP demultiplexing.
6. [rdt] Consider a reliable data transfer protocol that uses only negative acknowledgments.Suppose the sender sends data only infrequently. Would a NAK-only protocol be preferable to aprotocol that uses ACKs? Why? Now suppose the sender has a lot of data to send and the end-to-end connection experiences few losses. In this second case, would a NAK-only protocol bepreferable to a protocol that uses ACKs? Why?
arrow_forward
QUESTION 13
Fill the blank
With the TCP server, there is a welcoming socket, and each time a client
initiates a connection to the server, a new socket is created. Thus, to support n
simultaneous connections, the server would need
sockets.
O n-1
On
O n+1
0 1
arrow_forward
/* the following routine will be called once (only) before any other */
/* entity A routines are called. You can use it to do any initialization */
void a joit!)
{
}
/* Note that with simplex transfer from a-to-B, there is no Beutet() */
/* called from layer 3, when a packet arrives for layer 4 at B*/
int 559
int Bwaiting acti
struct pkt last Recketi
int calculate.sheskum
// change the sequence and change the state.
B.seq=SWAP(B.Seal:
{
Bwaiting.ads=0
void input(packet)
struct pkt packet:
// If the checksum of the packet is not matching, ignore the packet and send NAK
iffeacket.sheskawm != calculate_shesksum(&packet)){
printf("\tBinet: Corrupted packet received. Dered and sending NAK.\n");
arrow_forward
1 IntroductionThe objective of this project is to learn TCP client-server interaction using a socket interface in C programming language. After completing this Project, you will have a basic understanding of the steps required todevelop a networking application.
2 Project SpecificationIn this project, you are required to do socket programming in C language (Linux environment) to implementa pair of client and server that can achieve simple password verification to indicate the current market valueof the stock. Your client will send a pair of username and password to your server and your server willverify whether the pair of username and password is legitimate or not for retrieving the stock value. Assumethe only legitimate pairs of usernames and passwords that will be accepted by your server are as follows.
Username Password StockValuelcid welpa23e 13.93mrvl ghqwo31a 41.23snap tyjli14d 10.21cl1 rjwqe83f 85.09bro gnmds28z 56.43cvs rhktl87c 91.34…
arrow_forward
b) Answer the following questions related to HTTP:
i) Explain how the ability of the Java Socket class to return an OutputStream would be affected
if there was no TCP protocol.
ii) "Pipelining reduces the number of requests/replies during an HTTP connection". Do you agree
with this statement? Explain your answer.
iii) "Including the string Connection: close in an HTTP GET message request is a way to ask the
server to terminate the connection". Do you agree with this statement? Explain your answer.
arrow_forward
- Q4/Assume a system of 35 cells with a cell radius of 1.5 km, a total frequency
bandwidth that supports 500 traffic channels, and a reuse factor of N =7.
- (a) If there are 35 total cells, what geographic area is covered, how many channels
are there per cell, and what is the total number of concurrent calls that can be
handled?
1 (b) Repeat for a cell radius of 0.5 km and 120 cells.
arrow_forward
SUBJECT : COMPUTER NETWORKING
(PLEASE PROVIDE COMPLETE RELEVANT SOLUTION)
One important issue in networking is the performance of the network. The question is how can measure the performance of heterogeneous networks. For example, UIIT University network which provides access to students at both wired and wireless networks. In this kind of scenario:
You may need to define key performance parameters that can be used to evaluate the network performance.
If UIIT has a total bandwidth of 100Mbps and 40Mbps is reserved for admin and faculty. Due to COVID-19 pandemic total students coming daily altogether in morning and evening are 500. How much bandwidth a student can achieve if all students are using internet at the same time?
arrow_forward
Why are TCP and UDP used while writing socket code? Exists an other method for writing code
for sockets?
arrow_forward
Computer Networking Assignment 2
Lab 2: Web Server Lab
In this lab, you will learn the basics of socket programming for TCP connections in Python: how to create a socket, bind it to a specific address and port, and send and receive a HTTP packet. You will also learn some basics of HTTP header format.
You will develop a web server that handles one HTTP request at a time. Your web server should accept and parse the HTTP request, get the requested file from the server’s file system, create an HTTP response message consisting of the requested file preceded by header lines, and send the response directly to the client. If the requested file is not present in the server, the server should send an HTTP “404 Not Found” message back to the client.
Code
Below you will find the skeleton code for the Web server. You are to complete the skeleton code. The places where you need to fill in code are marked with #Fill in start and #Fill in end. Each place may require one or more lines of code.…
arrow_forward
Computer networking subject rcs817
arrow_forward
7. Q: Assume a client calls an asynchronous RPC to a server, and subsequently
waits until the server returns a result using another asynchronous RPC. Is this
approach the same as letting the client execute a normal RPC? What if we
replace the asynchronous RPCs with asynchronous RPCs?
arrow_forward
4 LANS are connected to a router (R1) with each LAN compares of several hosts connected to a switch. Each LAN cotains the following number of hosts (end devices and the gateway interface), • LANI à 30 Hosts
• LAN2 à 15 Hosts
• LAN3 à 20 Hosts
• LAN4 à 3 Hosts
You have received the address space 200.16.1.0/24. Use the address space to create a subnetting scheme of four subnets with equal size in a way to accommodate the number of hosts required. Consider the following points in your answer,
/ Explain the procedure of your subnetting scheme
/ Highlight the suitable prefix and the subnet mask
/ Highlight the number of wasted hosts in each subnet after determining the most suitable prefix
/ Use the table below to provide the subnet details for each LAN
Subnet Address First Host address Last Host address Broadcast address
1 LANI
2 LAN2
3 LAN3
4 LAN4
arrow_forward
(4) Please select all statements that are true. When a TCP application issues a send over a
socket, it must pass a pointer to a buffer that must be large enough to:
a. Hold all of the data that must be transferred by the connection.
b. Hold a portion of the data that is to be sent by TCP that must be at least 64Kbytes
large.
c. Hold a portion of data to be sent next, inclusive of the TCP and IP headers .
d. Hold at least the next byte to be send by TCP.
arrow_forward
Computer Networks - Internet Architecture & Application Layer
arrow_forward
*Computer Networks*
Please solution is correct, complete and clear
arrow_forward
IKT204-G H21, Routing tables
13
In this assignment, the objective is to determine the correct forwarding link given the routing table below.
A router has the following entries in its forwarding table:
Link1: 00001010.10101000.00000100.00000000/22
Link2: 00001010.10101000.00000110.00000000/23
Link3: 00001010.10101000.00000111.00000000/24
Link4: 00001010.10101000.00000000.00000000/16
Link5: All other addresses
Assume the router receives IPV4 datagrams destined to the following addresses and decide which link they are
forwarded to:
A: 00001010.11111000.00000101.00001111
B: 00001010.10101000.00000111.00011000
C: 00001010.10101000.00000011.01010000
D: 00001010.10101000.00000111.11111110
E: 00001010.10101000.00000110.10000010
On which link will they be forwarded?
A: link
B: link
C: link
D: link
E: link
arrow_forward
#write code for the server
#write code for the client
the Card number = 1000987
password number = 2222
then check password correct or not
thrn appy transcation processs
# code must must use so socket library (import socket)
#tcp connection
# python language please
arrow_forward
Describe a company's Virtual Machine (VM) requirement for at least two VMs. Analyse the requirements and transform the requirements into
technical requirements of the VMs, including CPU, memory and disks. Design a solution for the required computing system. Implement the
design and log the implementation with screenshots.
The following parameters need to be specific to you otherwise will be considered as invalid.
The last two digits of the ip address of the two VMs are from the last 4 digits of your student number.(i.e student number: 20172266)
The VM name and adapter name starts with your given name. (given name: rishab)
To be submitted and demo to the lecturer should include the following sections:
1 Requirement description
2 Analysis of the requirement
3 Design-Parameters
4 Design – implementation Scripts or GUI Steps (using GUI to implement is not optimal but accepted solution)
5 Implementation -Screenshots
6 You can use an earlier prepared image as VHDX to reduce the time for…
arrow_forward
Socket programming in c language in windows
Implement one server and three clients using multithreaded exchanging messages between them and then doing checksum error detection or parity
arrow_forward
computer science
answer only 100% sure else downvote strictly posted multiple times dont answer if not known
dont post existing ones
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Related Questions
- (please type answer fast.)arrow_forward1) Describe briefly the main technical steps involved in setting up a network server in Java via TCP/IP. 2) Describe briefly the main technical steps involved in setting up a network client in Java via TCP/IP. The only information I have so far is that the server listens to a specific port, waits for connection requests from a client and establishes dedicated connection at an assigned port bound with a socket. The client talks to the server via its dedicated socket.arrow_forwardi have answered B in this question, but i am not sure if it is correct ? if not which one is ? thank you :)arrow_forward
- - Q4/Assume a system of 40 cells with a cell radius of 1 km, a total frequency bandwidth that supports 500 traffic channels, and a reuse factor of N= 4. - (a) If there are 40 total cells, what geographic area is covered, how many channels are there per cell, and what is the total number of concurrent calls that can be handled?arrow_forwardq9c- Context- Alice and Bob are members of the same Kerberos realm. They are both currently logged in with active session keys from the Kerberos KDC (key distribution centre). As per the Kerberos standard, the KDC has created unique session keys for both Alice and Bob, and then discarded them once received by the respective users. Alice wants to access a resource owned by Bob and contacts the KDC to request the necessary material. Answer the following questions about this scenario: Q- When Bob receives the service ticket from Alice, why should he trust her and what guarantees the service ticket is genuine and wasn’t forged by Alice?arrow_forward4. [Socket] What is a socket? Suppose a process in Host C has a UDP socket with port number6789. Suppose both Host A and Host B send a UDP segment to Host C with destination portnumber 6789. Will both segments be directed to the same socket at Host C? If so, how will theprocess at Host C know that these two segments originated from two different hosts? 5. [Demultiplex] Define multiplexing and demultiplexing. Briefly explain how TCP demultiplexing isdifferent than UDP demultiplexing. 6. [rdt] Consider a reliable data transfer protocol that uses only negative acknowledgments.Suppose the sender sends data only infrequently. Would a NAK-only protocol be preferable to aprotocol that uses ACKs? Why? Now suppose the sender has a lot of data to send and the end-to-end connection experiences few losses. In this second case, would a NAK-only protocol bepreferable to a protocol that uses ACKs? Why?arrow_forward
- QUESTION 13 Fill the blank With the TCP server, there is a welcoming socket, and each time a client initiates a connection to the server, a new socket is created. Thus, to support n simultaneous connections, the server would need sockets. O n-1 On O n+1 0 1arrow_forward/* the following routine will be called once (only) before any other */ /* entity A routines are called. You can use it to do any initialization */ void a joit!) { } /* Note that with simplex transfer from a-to-B, there is no Beutet() */ /* called from layer 3, when a packet arrives for layer 4 at B*/ int 559 int Bwaiting acti struct pkt last Recketi int calculate.sheskum // change the sequence and change the state. B.seq=SWAP(B.Seal: { Bwaiting.ads=0 void input(packet) struct pkt packet: // If the checksum of the packet is not matching, ignore the packet and send NAK iffeacket.sheskawm != calculate_shesksum(&packet)){ printf("\tBinet: Corrupted packet received. Dered and sending NAK.\n");arrow_forward1 IntroductionThe objective of this project is to learn TCP client-server interaction using a socket interface in C programming language. After completing this Project, you will have a basic understanding of the steps required todevelop a networking application. 2 Project SpecificationIn this project, you are required to do socket programming in C language (Linux environment) to implementa pair of client and server that can achieve simple password verification to indicate the current market valueof the stock. Your client will send a pair of username and password to your server and your server willverify whether the pair of username and password is legitimate or not for retrieving the stock value. Assumethe only legitimate pairs of usernames and passwords that will be accepted by your server are as follows. Username Password StockValuelcid welpa23e 13.93mrvl ghqwo31a 41.23snap tyjli14d 10.21cl1 rjwqe83f 85.09bro gnmds28z 56.43cvs rhktl87c 91.34…arrow_forward
- b) Answer the following questions related to HTTP: i) Explain how the ability of the Java Socket class to return an OutputStream would be affected if there was no TCP protocol. ii) "Pipelining reduces the number of requests/replies during an HTTP connection". Do you agree with this statement? Explain your answer. iii) "Including the string Connection: close in an HTTP GET message request is a way to ask the server to terminate the connection". Do you agree with this statement? Explain your answer.arrow_forward- Q4/Assume a system of 35 cells with a cell radius of 1.5 km, a total frequency bandwidth that supports 500 traffic channels, and a reuse factor of N =7. - (a) If there are 35 total cells, what geographic area is covered, how many channels are there per cell, and what is the total number of concurrent calls that can be handled? 1 (b) Repeat for a cell radius of 0.5 km and 120 cells.arrow_forwardSUBJECT : COMPUTER NETWORKING (PLEASE PROVIDE COMPLETE RELEVANT SOLUTION) One important issue in networking is the performance of the network. The question is how can measure the performance of heterogeneous networks. For example, UIIT University network which provides access to students at both wired and wireless networks. In this kind of scenario: You may need to define key performance parameters that can be used to evaluate the network performance. If UIIT has a total bandwidth of 100Mbps and 40Mbps is reserved for admin and faculty. Due to COVID-19 pandemic total students coming daily altogether in morning and evening are 500. How much bandwidth a student can achieve if all students are using internet at the same time?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- 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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education