In this assignment, you will write two complete C programs to support a client/server model using Linux sockets for a UDP “ping” utility, similar to the ping utility already available on our CSE machines.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
PROGRAM DESCRIPTION:
In this assignment, you will write two complete C programs to support a client/server
model using Linux sockets for a UDP “ping” utility, similar to the ping utility already
available on our CSE machines.
 Server
o The server program will be called with one command-line argument, the port
number being used, such as ./minor4svr 8001. If the user calls the server
program with too few or too many arguments, you will print out a usage
statement and terminate the program.
o The server will set up a UDP socket on the Internet (i.e., INET) domain and
then wait in an infinite loop listening for incoming UDP packets, specifically
PING messages from a client.
o Packet Loss
UDP provides applications with an unreliable transport service. Messages
may get lost in the network due to a variety of reasons. Since packet loss is
rare or even non-existent in typical campus networks, the server in this lab
will inject artificial loss to simulate the effects of network packet loss. The server
will simulate 30% packet loss through generation of a seeded, randomized
integer that will determine whether a particular incoming PING message is lost
or not.
o When a PING message comes in and if the packet is not lost, the server will
print the client message to the terminal and then send a PONG message back
to the client. If the packet is determined to be lost, the server will print an
appropriate message to the terminal and simply “eat” the message by not
responding to the client.
 Client
o The client program will be called with two command-line arguments, the
hostname of the server and the port number being used, such as
./minor4cli cse06 8001. If the user calls the client program with too few
or too many arguments, you will print out a usage statement and terminate
the program.
o The client will send 10 automated PING messages to the server on a UDP
socket, where automated means the message is built in the code, not entered
from the keyboard. Because UDP is an unreliable protocol, a packet sent
from the client to the server may be lost in the network, or vice versa. For this
reason, the client cannot wait indefinitely for a reply to a PING message. You
should get the client to wait up to one second for a reply – if no reply is received
within one second, your client program should assume that the packet was
lost during transmission across the network.
o Specifically, for each of the 10 PING messages, your client program should:
■ send the PING message using the UDP socket and print a status
message;
■ if the response message is received from the server, calculate and
print the round trip time (RTT) in milliseconds for each message;
otherwise, print a status message that it timed out.
o After all of the PING messages have been sent (and responses received or
timed out), the client program should report:
■ the number of messages sent, the number of messages received, and
the message loss rate (as a percentage);
■ the minimum, maximum, and average RTTs for all of the PING
messages in milliseconds.
Your program should run on the INET domain using SOCK_DGRAM (i.e., UDP) sockets
so that the server and the client execute on a different CSE machine.
Given the randomness of what messages get dropped, it could be that less than or
greater than 30% of the messages are dropped.
You will also need to make sure you are able to handle any error cases.
SAMPLE OUTPUT (user input shown in bold):
==> SERVER on cse04
mat0299@cse04:~/csce3600/sp22$ ./minor4svr
usage: ./minor4svr <port>
mat0299@cse04:~/csce3600/sp22$ ./minor4svr 8001
[server]: ready to accept data...
[client]: PING
[client]: PING
[client]: PING
[client]: PING
[client]: PING
[client]: PING
[server]: dropped packet
[client]: PING
[client]: PING
[client]: PING
[server]: dropped packet
[client]: PING
[client]: PING
[client]: PING
[client]: PING
 
 
 
 
 
 
 
3
[client]: PING
[client]: PING
[client]: PING
[client]: PING
[client]: PING
[client]: PING
[client]: PING
[server]: dropped packet
^C
==> CLIENT on cse05
mat0299@cse05:~/csce3600/sp22$ ./minor4cli
usage : ./minor4cli <hostname> <port>
mat0299@cse05:~/csce3600/sp22$ ./minor4cli cse04
usage : ./minor4cli <hostname> <port>
mat0299@cse05:~/csce3600/sp22$ ./minor4cli cse04 8001
1: Sent... RTT=0.983000 ms
2: Sent... RTT=0.245000 ms
3: Sent... RTT=0.208000 ms
4: Sent... RTT=0.237000 ms
5: Sent... RTT=0.199000 ms
6: Sent... Timed Out
7: Sent... RTT=0.483000 ms
8: Sent... RTT=0.352000 ms
9: Sent... Timed Out
10: Sent... RTT=0.515000 ms
10 pkts xmited, 8 pkts rcvd, 20% pkt loss
min: 0.199000 ms, max: 0.983000 ms, avg: 0.279875 ms
mat0299@cse05:~/csce3600/sp22$ ./minor4cli cse04 8001
1: Sent... RTT=0.652000 ms
2: Sent... RTT=0.368000 ms
3: Sent... RTT=0.267000 ms
4: Sent... RTT=0.291000 ms
5: Sent... RTT=0.359000 ms
6: Sent... RTT=0.406000 ms
7: Sent... RTT=0.228000 ms
8: Sent... RTT=0.358000 ms
9: Sent... RTT=0.350000 ms
10: Sent... Timed Out
10 pkts xmited, 9 pkts rcvd, 10% pkt loss
min: 0.228000 ms, max: 0.652000 ms, avg: 0.291889 ms
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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 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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY