

\documentstyle[twocolumn]{article}

\setlength{\oddsidemargin}{-0.5in}
\setlength{\evensidemargin}{-0.5in}
\setlength{\topmargin}{-0.5in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\textwidth}{7.5in}
\setlength{\textheight}{9.8in}
\setlength{\parindent}{0in}
\setlength{\parskip}{0.1in}
\setlength{\columnseprule}{0.4pt}

\begin{document}

\bf
\hfill Name:  $\underline{ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }$
% \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\rm
\bigskip
                                      
{\bf Directions:} Work on this sheet (both sides, if needed) only;
{\bf do not turn in any supplementary sheets of paper}.  
In order to get full credit, {\bf SHOW YOUR WORK.}

{\bf 1.} (10) Fill in the blanks:  The layer within the 7-layer model which
breaks messages into small pieces on the sending end and reassembles
them on the receiving end is \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_.  In the
protocol which forms the basis of the Internet, the service which
performs this operation is called \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_.

{\bf 2.} (10) The name of a system function which our program
would call to convert an ``English'' Internet address, say
www.yahoo.com, to the numerical one, in this case 204.71.200.75, is
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_.

{\bf 3.} (10) The name of a system function which our program
would call to ask for special options in our socket is
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_.

{\bf 4.}  (5) Suppose we were to set up an online movie video service,
which customers would use to download movies through the Internet.
Based on the discussion we had in class about this, what value would
we likely use for the second argument in our call to socket() in the
code for the server?

{\bf 5.}  (5) Walrand's description of asynchronous serial transmission
differs slightly from that in our handout, concerning the voltage level
of what our handout calls \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_.

{\bf 6.}  (5) Look at line 44 of WPsClient.c in our handout.  Which famous
Unix client would have a similar line,

\begin{verbatim}
Addr.sin_port = 21;
\end{verbatim}

{\bf 7.} (10) Consider an HDLC frame with 16-bit CRC.  We monitor the
frame by using a device attached to the transmission line, and observe
that the last 36 bits on the line are (in hex notation) 0x1f7ab917e.
Give the hex value of the last byte of the actual data in the user's
original message.

{\bf 8.}  (5) In the Fourier series example in our handout on physical
layer, say the transmission rate were to change to 1 MHz, but with
no other changes.  Which is true: (i) T would double. (ii) T would be
halved. (iii) T would stay the same. (iv) None of (i), (ii) or (iii)
would necessarily be true.

{\bf 9.}  (5) In the BPSK example on p.211 of Walrand, the main frequency
range was [525 Hz, 675 Hz].  What would that change to if the
transmission rate were to be reduced to 50 bits per second?

{\bf 10.} Consider messages consisting 2 bits plus a parity bit, thus
3 bits in all.  Each bit, including the parity bit, has probability p of
being in error, independently of the others.

\begin{itemize}

\item [(a)]  (10) What proportion of all messages will result in a report
of an error?

\item [(b)] (10) Given that there is a report of no error, what is the
probability that the report is correct?

\end{itemize}

{\bf 11.}  (15)
Suppose we have two program source files, named X.c and Y.c, which will
act as server and client, respectively.  The goal of X.c is to send
two text files, consisting of 500 bytes each, which Y.c will receive
and print to stdout.  The X.c program will do this using two calls to
write(), each writing 500 bytes to the socket.  Y.c will preface its
output of the first file by printing "first file:" and then announce
"second file:" for the second.  Y.c will read the data sent by X.c on a
socket whose descriptor name is SD.  Sockets will use TCP.

Write the code in Y.c.  Write the complete program, except for the
``setup'' parts:  the declarations and the initialization code calling
socket() and connect().

{\bf Solutions:}

{\bf 1.}  transport; TCP

{\bf 2.}  gethostbyname()

{\bf 3.}  setsockopt()

{\bf 4.}  SOCK\_DGRAM

{\bf 5.}  idle state

{\bf 6.}  ftp

{\bf 7.}  0xff 

{\bf 8.}  (i)

{\bf 9.}  [575,625]

{\bf 10}  (a) $3p {(1-p)}^2 + p^3; (b) \frac{{(1-p)}^3}{{(1-p)}^3
+ 3 p^2 (1-p)}
\end{document}

