CS 779/879
Design
of Network Protocols
Spring
2004
Final
Exam
Time
2 & 1/2 hours
Open
Book & Notes
Name:
Login:
In
achieving concurrency, we may use one of the following three
techniques:
1. Fork
2. Thread
3. Select
In
the following two problems use any technique at most once to
solve the concurrency problem.
Q1: [40 points]
Write
a tcp-based program C that allows two persons A and B to
chat with each other. The syntax of
using C is:
% C <host>
Where <host> is
an IP address of the other person.
For example, person A
types:
% C <ip-address-of-host B>
While person B types:
% C <ip-address-of-host A>
C creates a tcp socket t, connects it to <host> at port 4444. If the
connection is not established within 4 seconds, it waits for a connection from <host>
and port 4444. Any connection that comes from a different host or a
different port should be rejected.
When the connection is
established, C displays the message:
“Please type any thing followed by return. To exit
type ctrl-D”
The
program then concurrently:
1. Reads any message from the
keyboard and the sends it to t
2. Receives any message from t
and displays it to the TTY.
Q2: [40 points]
In the following we would like to develop a udp
tunnel to allow
two different groups (e.g., one at ODU the other at UNC) to chat using
multicast as shown below:
CcC ODU UNC T T C C C C C C udp
socket Mcast socket C Chat ClientClient T Server udp tunnel
Write
the code for T. The syntax of using T is:
% T <host>
Where
<host> is the IP address of
the other end of the tunnel.
T creates two sockets:
1. A udp socket u connected
to <host> and port 2222.
2. A multicast socket m
that joins the multicast group “224.1.1.1/4444”.
T then concurrently:
1. sends any message received
from u to m.
2. sends any message received
from m to u.
Make
sure to set the “loopback” of m appropriately.
Q3: [20 points]
A.
In Q2, what is the effect of
changing the multicast port from 4444 to 2222?
B.
In Q2, what is the meaning
of the sentence?
Make sure to set the “loopback”
of m appropriately
C.
In SCTP, what is the
corresponding concept to the TCP’s KEEPALIVE?
D.
How to express an IP4
address (e.g., 128.82.4.8) as an IP6
address?