%% LyX 1.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[twocolumn]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\setlength\parskip{\medskipamount}
\setlength\parindent{0pt}

\makeatletter


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\setlength\parskip{\medskipamount}
\setlength\parindent{0pt}

\makeatletter


\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\setlength\parskip{\medskipamount}
\setlength\parindent{0pt}

\makeatletter


\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\setlength\parskip{\medskipamount}
\setlength\parindent{0pt}

\makeatletter


\usepackage[T1]{fontenc}
\setlength\parskip{\medskipamount}
\setlength\parindent{0pt}

\makeatletter


\usepackage[T1]{fontenc}
\setlength\parskip{\medskipamount}
\setlength\parindent{0pt}

\makeatletter


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

\makeatother

\makeatother

\makeatother


\makeatother


\makeatother


\makeatother

\begin{document}

Name: \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

\textbf{Directions: Work only on this sheet (on both sides, if needed); do not
turn in any supplementary sheets of paper. There is actually plenty of room
for your answers, as long as you organize yourself BEFORE starting writing.
In order to get full credit, SHOW YOUR WORK. Earlier problems tend to be easier.}

\textbf{1.} (10) Look at line 36, p.15 of the overview unit in our notes. Show
what this line would be changed to if we were to use UDP.

\textbf{2.} (10) Look at the \textbf{wps}/\textbf{svr} illustration in the lecture
notes supplement StackExample.pdf. Suppose no options are used by either TCP
or IP. What will be the length in bytes of the IP packet which arises from the
call to write()?

\textbf{3.} (5) Fill in the blank with a term discussed in class: The HTTP Web
protocol is connectionless. However, Web browsers use a mechanism called \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
to add some connection-oriented aspects.

\textbf{4.} (10) In our discussions in class on Fourier analysis, we were primarily
concerned about the fact that any medium has an upper bound on the signal frequencies
it can transmit effectively. However, some media have nonzero lower bounds as
well. Quote a specific example of such a lower bound from our course materials.

\textbf{5.} In our homework, suppose person X uses MailClnt on her PC to check
her mailbox mb1 on a certain remote machine on which MailSvr is running. Then
she exits MailClnt, and then immediately starts MailClnt again, and checks another
mailbox, mb2, that she has on that same machine. Meanwhile the server has been
running continuously.

\begin{itemize}
\item (a) (20)For each of the following, answer whether the two runs of MailClnt will
be the same in the aspect given, e.g. the same number, the same string, etc.
Answer S for same, D for different:


server port number \\
 client port number \\
 server IP address \\
 client IP address \\
 server Ethernet address \\
 client Ethernet address\\
 result of server call to getpeername() \\
 result of client call to gethostbyname() \\
 result of client call to getsockname()

\item (b) (5) Fill in the blank according to our discussion in class: The homework
problem had MailSvr serving just one client at a time. In order to handle multiple
clients at once, e.g. to have multiple clients simultaneously in the r-command
loop, we would need to use Java's \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ facility. 
\end{itemize}
\textbf{5.} (10) On the top line of p.385 of Leon-Garcia, \char`\"{}residual
noise\char`\"{} is mentioned. Using the symbols from pp.5-6 of our notes, quantify
this; i.e. give a math expression for the residual noise from other stations
when we are trying to receive from node s.

\textbf{6.} (5) In our notes the Presentation Layer was described as a level
at which differences in character sets between server and client could be resolved.
However, Leon-Garcia notes that there may be differences in how integers are
represented as well. What specific function mentioned in our course materials
could be called to deal with this problem?

\textbf{7.} (10) Look at the Welsh matrix \( W_{4} \) on p.6 of our notes.
Suppose we have only 3 stations sending. One of the 4 codes would be less desirable
than the others. State which one, and give a very specific reason, citing a
specific quote in either the notes or Leon-Garcia.

\textbf{8.} Consider the random-code version of CDMA. Your answers to both of
the following questions should be functions of G. Let L be the value of the
inner product of the sender's code with the code of some other node.

\begin{itemize}
\item (a) (5) Find P(L = 0). 
\item (b) (10) Find P(L = +2).
\end{itemize}

\paragraph*{Solutions:}


\paragraph*{1. }

SD = socket(AF\_INET,SOCK\_DGRAM,0);

\textbf{2.} 22 bytes for the TCP packet (20 bytes header, 2 data) plus 20 more
for the IP header, so 42 bytes total.

\textbf{3.} Cookies.

\textbf{4.} See p.123 of LG, {}``This situation...200 Hz.{}''

\textbf{5.a.} All our S except the second and last.

\textbf{5.b.} Threads.

\textbf{5. \( \sum ^{n}_{i=0,i\neq s}d_{i}\sum ^{g}_{k=0}c_{ik}c_{sk} \)}

\textbf{6.} htons()

\textbf{7.} See p.389 of LG, concerning codes which do not fluctuate between
1 and -1 often enough.

\textbf{8.} Let N denote the number of bits on which the other code matches
the sender's code. Then N is a binomially-distributed random variable with parameters
G and 1/2. Assume G is even (otherwise the probabilities here are 0).

\textbf{a. }

\( P(L=0)=P(N=\frac{G}{2})=\left( \begin{array}{c}
G\\
2
\end{array}\right) (\frac{1}{2})^{G} \)

\textbf{b.}

\( P(L=2)=P(N=\frac{G}{2}+1)=\left( \begin{array}{c}
G\\
\frac{G}{2}+1
\end{array}\right) (\frac{1}{2})^{G} \)
\end{document}

