CS 779/879
Design of Network Protocols
Spring 2013
Second Exam
Time 2 & 1/2 hours
Open Book
Name:
Login:
All questions are of equal weights.
Question 1:
A. In assignment #4 you were
asked to write a general chat client with the following options:
{ m, t, s, q, x, l}. Show which
of these options can be easily implemented using the sock program. Explain?
B. Two users, one at something
and the other at somethingmore, have decided
to use the sock program to chat with each other as follows:
something % sock –s 10555
somethingmore % sock something 10555
What
is the property of sock that enabled them to chat?
C. Assume that DrWahab was logging into something and he wanted to start a
tcp server using his favorite port “10555” but he
gets the error message: “Address already in use”
Describe how DrWahab can discover the login name of the person
using port 10555 so that he can send that person a message to release the port
in exchange of a better grade in his cs779/879 course J
D. In simultaneous open,
how may handshake TCP packets are exchanged to establish a tcp
connection
between the two client programs?
E. In simultaneous close,
how many handshake TCP packets are exchanged to close a tcp
connection?
Question 2:
A. List all possible types of
server sockets that can simultaneous use the same port number (e.g., 10555)
on the same host without
getting the error message: “Address already in use”.
B. Give an example
of a situation where we must
use recv on a TCP socket.
C. Give an example of a
situation where we must use recvmsg on a UDP socket.
Question 3:
A possible server design alternative
is to combine pre-forking &
forking-on-demand as follows:
·
The main process creates a server socket S and forks N
children processes.
·
The N processes accept connections at S and one by one serve the incoming
clients.
·
If a client arrives while all the N children processes are busy serving clients,
the main process steps forward
and accepts that client and creates a temporary child
to serve that client. The
temporary child process exits upon serving the client.
Explain how the main process
can monitor the N children and S to implement this combined
approach?.
Question 4:
Implement
the following program:
portscan <host>
The
program connects to every tcp ports at <host>
and prints out those ports it successfully connects to.
Your
implementation should be very fast by not waiting for the default long
time it may rake for the connect call to return; sometimes it can be time 2
minutes.
Question 5:
A. Consider the following set of SCTP Servers and Clients
programs:
Each program is named: XYZ, where:
X
{S: Server, C:
Client}
Y
{4: IP4, 6:
IP6}
Z
{S: Stream, Q:
Sequence Packet}
S4S:
Server IPv4 Stream
S6S:
Server IPv6 Stream
C4S:
Client IPv4 Stream
C6S:
Client IPv6 Stream
S4Q: Server
IPv4 Sequence Packet
S6Q:
Server IPv6 Sequence Packet
C4Q:
Client IPv4 Sequence Packet
C6Q:
Client IPv6 Sequence Packet
Each client has to specify the IP address of the
server. The IP address of the server may be specified using one or more of the following
three format:
4: IPv4
address format, e.g: 128.82.4.210
6: IPv6
address format, e.g: fe80::203:baff:fe2a:67ff
f: IPv4-mapped
IPv6 address, e.g., ::ffff:128.82.4.210
Use the above symbols i
{4, 6, f} to fill in each entry in the
following Table with all possible correct address formats
that can be used by a client to interact with the corresponding server:
|
C4S |
C6S |
C4Q |
C6Q |
|
|
S4S |
||||
|
S6S |
||||
|
S4Q |
||||
|
S6Q |
B. Consider the following set of TCP/UDP Servers and Clients programs:
Program
Name: XYZ, where:
X
{S: Server, C: Client}
Y
{4: IP4, 6: IP6}
Z
{T: TCP, U: Unicast, M:Multicast}
S4T:
Server IPv4 TCP
S6T:
Server IPv6 TCP
S4U:
Server IPv4 UDP
S6U:
Server IPv6 UDP
S4M:
Server IPv4 Multicast
S6M:
Server IPv6 Multicast
ü The UDP Servers receives unicast messages and send unicast
replies to senders
ü The Multicast Server receives unicast
& multicast messages and sends unicast replies to senders
C4T:
Client IPv4 TCP
C6T:
Client IPv6 TCP
C4U:
Client IPv4 UDP
C6U:
Client IPv6 UDP
C4M:
Client IPv4 Multicast
C6M:
Client IPv6 Multicast
Each of these clients
concurrently:
·
Reads messages
from 0 and send it to socket
·
Reads messages
from socket send send it 1.
ü The
UDP Clients send and receives unicast messages.
ü The Multicast Clients send multicast messages
and receives unicast
& multicast messages.
The IP address may be specified using one or more of
the following three formats:
4: IPv4
address format, e.g: unicast
128.82.4.210 &
multicast 224.0.0.1
6: IPv6
address format, e.g unicast
fe80::203:baff:fe2a:67ff & multicast ff80::203:baff:fe2a:6722
f:
IPv4-mapped IPv6 address, e.g., unicast ::ffff:128.82.4.210
& multicast ::ffff:224.0.0.1
Use the above symbols
(4, 6, f) to fill in each entry in the
following Table with all possible correct address formats
that can be used by a client to interact with the corresponding server:
|
C4T |
C6T |
C4U |
C6U |
C4M |
C6M |
|
|
S4T |
|
|
||||
|
S6T |
|
|
||||
|
S4U |
|
|
||||
|
S6U |
|
|
||||
|
S4M |
|
|
||||
|
S6M |
|
|