\documentclass[a4paper,12pt]{article}

\usepackage{listings}
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{color}

\begin{document}

\author{Ben Kero}
\title{Lab 3}
\maketitle
\lstset{numbers=left,breaklines=true,basicstyle=\scriptsize,framexleftmargin=5mm,frame=shadowbox,rulesepcolor=\color{blue}}
\begin{enumerate}
    \item The IP address of my computer is 192.168.1.102.  The TCP source port number is 1161.
    \begin{lstlisting}
No.     Time        Source                Destination           Protocol Info
      1 0.000000    192.168.1.102         128.119.245.12        TCP      health-polling > http [SYN] Seq=0 Win=16384 Len=0 MSS=1460

Frame 1 (62 bytes on wire, 62 bytes captured)
Ethernet II, Src: Actionte_8a:70:1a (00:20:e0:8a:70:1a), Dst: LinksysG_da:af:73 (00:06:25:da:af:73)
Internet Protocol, Src: 192.168.1.102 (192.168.1.102), Dst: 128.119.245.12 (128.119.245.12)
Transmission Control Protocol, Src Port: health-polling (1161), Dst Port: http (80), Seq: 0, Len: 0
    Source port: health-polling (1161)
    Destination port: http (80)
    Sequence number: 0    (relative sequence number)
    Header length: 28 bytes
    Flags: 0x02 (SYN)
    Window size: 16384
    Checksum: 0xf6e9 [correct]
    Options: (8 bytes)
        \end{lstlisting}

    \item The IP address of gaia.cs.umass.edu is 128.119.245.12, it is sending on port 1161 and receiving on port 80.
    \begin{lstlisting}
No.     Time        Source                Destination           Protocol Info
      2 0.023172    128.119.245.12        192.168.1.102         TCP      http > health-polling [SYN, ACK] Seq=0 Ack=1 Win=5840 Len=0 MSS=1460

Frame 2 (62 bytes on wire, 62 bytes captured)
Ethernet II, Src: LinksysG_da:af:73 (00:06:25:da:af:73), Dst: Actionte_8a:70:1a (00:20:e0:8a:70:1a)
Internet Protocol, Src: 128.119.245.12 (128.119.245.12), Dst: 192.168.1.102 (192.168.1.102)
Transmission Control Protocol, Src Port: http (80), Dst Port: health-polling (1161), Seq: 0, Ack: 1, Len: 0
    Source port: http (80)
    Destination port: health-polling (1161)
    Sequence number: 0    (relative sequence number)
    Acknowledgement number: 1    (relative ack number)
    Header length: 28 bytes
    Flags: 0x12 (SYN, ACK)
    Window size: 5840
    Checksum: 0x774d [correct]
    Options: (8 bytes)
    [SEQ/ACK analysis]
    \end{lstlisting}

    \item Skipped. (Not applicable because I'm using the provided trace.)

    \item Sequence number for TCP SYN segment: 0.  0x02 is the flag.  0x02 in binary os 00000010, meaning the SYN bit is setup.
    \begin{lstlisting}
No.     Time        Source                Destination           Protocol Info
      1 0.000000    192.168.1.102         128.119.245.12        TCP      health-polling > http [SYN] Seq=0 Win=16384 Len=0 MSS=1460

Frame 1 (62 bytes on wire, 62 bytes captured)
Ethernet II, Src: Actionte_8a:70:1a (00:20:e0:8a:70:1a), Dst: LinksysG_da:af:73 (00:06:25:da:af:73)
Internet Protocol, Src: 192.168.1.102 (192.168.1.102), Dst: 128.119.245.12 (128.119.245.12)
Transmission Control Protocol, Src Port: health-polling (1161), Dst Port: http (80), Seq: 0, Len: 0
    Source port: health-polling (1161)
    Destination port: http (80)
    Sequence number: 0    (relative sequence number)
    Header length: 28 bytes
    Flags: 0x02 (SYN)
        0... .... = Congestion Window Reduced (CWR): Not set
        .0.. .... = ECN-Echo: Not set
        ..0. .... = Urgent: Not set
        ...0 .... = Acknowledgment: Not set
        .... 0... = Push: Not set
        .... .0.. = Reset: Not set
        .... ..1. = Syn: Set
        .... ...0 = Fin: Not set
    Window size: 16384
    Checksum: 0xf6e9 [correct]
    Options: (8 bytes)
    \end{lstlisting}

    \item Sequence number of SYNACK segment: 0.  Value of ACK: 1.  It calculates the ACK value by incrementing the SYNACK.  The segment is 0x12, which is 00010010 in binary.  The second bit denotes SYN and fifth bit denotes ACK.
    \begin{lstlisting}
No.     Time        Source                Destination           Protocol Info
      2 0.023172    128.119.245.12        192.168.1.102         TCP      http > health-polling [SYN, ACK] Seq=0 Ack=1 Win=5840 Len=0 MSS=1460

Frame 2 (62 bytes on wire, 62 bytes captured)
Ethernet II, Src: LinksysG_da:af:73 (00:06:25:da:af:73), Dst: Actionte_8a:70:1a (00:20:e0:8a:70:1a)
Internet Protocol, Src: 128.119.245.12 (128.119.245.12), Dst: 192.168.1.102 (192.168.1.102)
Transmission Control Protocol, Src Port: http (80), Dst Port: health-polling (1161), Seq: 0, Ack: 1, Len: 0
    Source port: http (80)
    Destination port: health-polling (1161)
    Sequence number: 0    (relative sequence number)
    Acknowledgement number: 1    (relative ack number)
    Header length: 28 bytes
    Flags: 0x12 (SYN, ACK)
        0... .... = Congestion Window Reduced (CWR): Not set
        .0.. .... = ECN-Echo: Not set
        ..0. .... = Urgent: Not set
        ...1 .... = Acknowledgment: Set
        .... 0... = Push: Not set
        .... .0.. = Reset: Not set
        .... ..1. = Syn: Set
        .... ...0 = Fin: Not set
    Window size: 5840
    Checksum: 0x774d [correct]
    Options: (8 bytes)
    [SEQ/ACK analysis]
    \end{lstlisting}

    \item 6. Sequence number of TCP segment with POST: 1.
    \begin{lstlisting}
No.     Time        Source                Destination           Protocol Info
      4 0.026477    192.168.1.102         128.119.245.12        TCP      health-polling > http [PSH, ACK] Seq=1 Ack=1 Win=17520 Len=565

Frame 4 (619 bytes on wire, 619 bytes captured)
Ethernet II, Src: Actionte_8a:70:1a (00:20:e0:8a:70:1a), Dst: LinksysG_da:af:73 (00:06:25:da:af:73)
Internet Protocol, Src: 192.168.1.102 (192.168.1.102), Dst: 128.119.245.12 (128.119.245.12)
Transmission Control Protocol, Src Port: health-polling (1161), Dst Port: http (80), Seq: 1, Ack: 1, Len: 565
    Source port: health-polling (1161)
    Destination port: http (80)
    Sequence number: 1    (relative sequence number)
    [Next sequence number: 566    (relative sequence number)]
    Acknowledgement number: 1    (relative ack number)
    Header length: 20 bytes
    Flags: 0x18 (PSH, ACK)
        0... .... = Congestion Window Reduced (CWR): Not set
        .0.. .... = ECN-Echo: Not set
        ..0. .... = Urgent: Not set
        ...1 .... = Acknowledgment: Set
        .... 1... = Push: Set
        .... .0.. = Reset: Not set
        .... ..0. = Syn: Not set
        .... ...0 = Fin: Not set
    Window size: 17520
    Checksum: 0x1fbd [correct]
Data (565 bytes)

0000  00 06 25 da af 73 00 20 e0 8a 70 1a 08 00 45 00   ..%..s. ..p...E.
0010  02 5d 1e 21 40 00 80 06 a2 e7 c0 a8 01 66 80 77   .].!@........f.w
0020  f5 0c 04 89 00 50 0d d6 01 f5 34 a2 74 1a 50 18   .....P....4.t.P.
0030  44 70 1f bd 00 00 50 4f 53 54 20 2f 65 74 68 65   Dp....POST /ethe
0040  72 65 61 6c 2d 6c 61 62 73 2f 6c 61 62 33 2d 31   real-labs/lab3-1
0050  2d 72 65 70 6c 79 2e 68 74 6d 20 48 54 54 50 2f   -reply.htm HTTP/
0060  31 2e 31 0d 0a 48 6f 73 74 3a 20 67 61 69 61 2e   1.1..Host: gaia.
0070  63 73 2e 75 6d 61 73 73 2e 65 64 75 0d 0a 55 73   cs.umass.edu..Us
0080  65 72 2d 41 67 65 6e 74 3a 20 4d 6f 7a 69 6c 6c   er-Agent: Mozill
0090  61 2f 35 2e 30 20 28 57 69 6e 64 6f 77 73 3b 20   a/5.0 (Windows;
00a0  55 3b 20 57 69 6e 64 6f 77 73 20 4e 54 20 35 2e   U; Windows NT 5.
00b0  31 3b 20 65 6e 2d 55 53 3b 20 72 76 3a 31 2e 30   1; en-US; rv:1.0
00c0  2e 32 29 20 47 65 63 6b 6f 2f 32 30 30 33 30 32   .2) Gecko/200302
00d0  30 38 20 4e 65 74 73 63 61 70 65 2f 37 2e 30 32   08 Netscape/7.02
00e0  0d 0a 41 63 63 65 70 74 3a 20 74 65 78 74 2f 78   ..Accept: text/x
00f0  6d 6c 2c 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78   ml,application/x
0100  6d 6c 2c 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78   ml,application/x
0110  68 74 6d 6c 2b 78 6d 6c 2c 74 65 78 74 2f 68 74   html+xml,text/ht
0120  6d 6c 3b 71 3d 30 2e 39 2c 74 65 78 74 2f 70 6c   ml;q=0.9,text/pl
0130  61 69 6e 3b 71 3d 30 2e 38 2c 76 69 64 65 6f 2f   ain;q=0.8,video/
0140  78 2d 6d 6e 67 2c 69 6d 61 67 65 2f 70 6e 67 2c   x-mng,image/png,
0150  69 6d 61 67 65 2f 6a 70 65 67 2c 69 6d 61 67 65   image/jpeg,image
0160  2f 67 69 66 3b 71 3d 30 2e 32 2c 74 65 78 74 2f   /gif;q=0.2,text/
0170  63 73 73 2c 2a 2f 2a 3b 71 3d 30 2e 31 0d 0a 41   css,*/*;q=0.1..A
0180  63 63 65 70 74 2d 4c 61 6e 67 75 61 67 65 3a 20   ccept-Language:
0190  65 6e 2d 75 73 2c 20 65 6e 3b 71 3d 30 2e 35 30   en-us, en;q=0.50
01a0  0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e   ..Accept-Encodin
01b0  67 3a 20 67 7a 69 70 2c 20 64 65 66 6c 61 74 65   g: gzip, deflate
01c0  2c 20 63 6f 6d 70 72 65 73 73 3b 71 3d 30 2e 39   , compress;q=0.9
01d0  0d 0a 41 63 63 65 70 74 2d 43 68 61 72 73 65 74   ..Accept-Charset
01e0  3a 20 49 53 4f 2d 38 38 35 39 2d 31 2c 20 75 74   : ISO-8859-1, ut
01f0  66 2d 38 3b 71 3d 30 2e 36 36 2c 20 2a 3b 71 3d   f-8;q=0.66, *;q=
0200  30 2e 36 36 0d 0a 4b 65 65 70 2d 41 6c 69 76 65   0.66..Keep-Alive
0210  3a 20 33 30 30 0d 0a 43 6f 6e 6e 65 63 74 69 6f   : 300..Connectio
0220  6e 3a 20 6b 65 65 70 2d 61 6c 69 76 65 0d 0a 52   n: keep-alive..R
0230  65 66 65 72 65 72 3a 20 68 74 74 70 3a 2f 2f 67   eferer: http://g
0240  61 69 61 2e 63 73 2e 75 6d 61 73 73 2e 65 64 75   aia.cs.umass.edu
0250  2f 65 74 68 65 72 65 61 6c 2d 6c 61 62 73 2f 6c   /ethereal-labs/l
0260  61 62 33 2d 31 2e 68 74 6d 0d 0a                  ab3-1.htm..
    \end{lstlisting}

    \item
    \begin{lstlisting}
    Sequence #s:    Time sent:    Time ACK rcv'd:    Sample RTT:    Estimate RTT (Letting 'a'=0.125):
    1               0.026477      0.053937           0.02746        0.02746 (Just using sample for the first estimate)
    566             0.041737      0.077294           0.035557       0.028472125
    2026            0.054026      0.124085           0.070059       0.03986975
    3486            0.054690      0.169118           0.114428       0.075605125
    4946            0.077405      0.217299           0.139894       0.11761125
    6406            0.078157      0.267802           0.189645       0.146112875
    \end{lstlisting}

    \item \begin{itemize}
        \item Length of first "POST" segment: 565
        \item Length of remaining TCP segments: 1460 (each)
    \end{itemize}

    \item The window size never dipped below 16384.  It increases as the packet stream progresses to a maximum of 17520 for the remainder of the packets, except the last one, which has a window size of 16790.

    \item There were no duplicate ACKs, therefore there were no retransmissions.

    \item The receiver typically ACKs the successful reception of 1460 bytes, however sometimes ACKs exist where there is acknowledgement for exactly double the size.
\begin{lstlisting}
    59    1.200421    128.119.245.12    192.168.1.102    TCP    http > health-polling [ACK] Seq=1 Ack=35049 Win=62780 Len=0
    60    1.265026    128.119.245.12    192.168.1.102    TCP    http > health-polling [ACK] Seq=1 Ack=37969 Win=62780 Len=0
    61    1.362074    128.119.245.12    192.168.1.102    TCP    http > health-polling [ACK] Seq=1 Ack=40889 Win=62780 Len=0
\end{lstlisting}

    \item The TCP connection existed for 5.65 seconds, transmitting 164091.  From this the throughput can be calculated to be $\frac{164091}{5.65}$ bytes per second, or 29000 KB/sec.

    \item The TCP Slowstart phase begins at 0.0 and ends at 0.15 as denoted by the "wavy" stack. Congestion avoidance starts to have an effect on the TCP connection around 0.3, which can be identified by the stacks of dots.  Under idealized behavior of TCP, these stacks would be perfectly uniform, however since congestion control alters how these are queued/sent, the columns are slightly skewed.

    \item Slow-start phase is not clear on this plot, although I'd assume it is somewhere near the beginning, like from t=0.0 to t=0.01. Congestion avoidance takes over just after t=0.1. The stacks of dots are almost all vertical, but they are much closer together than the lab capture, meaning there is more data being transfered per unit time. Ideally, these stacks of dots would be perfectly vertical, but in practice, congestion exists.
    \begin{figure}[H]
        \includegraphics[scale=0.5]{stevens.pdf}
        \caption{tcp-ethereal-trace-1 Time-Sequence-Graph(Stevens)}
    \end{figure}
    \item I didn't see any evidence of a slow-start phase on this plot.  The behavior on this TCP sequence trace is much closer to the idealized behavior mentioned in the textbook.  Congestion control starts to take effect near the end of the packet, having the stacks skewed more than the beginning of the graph.
    \begin{figure}[H]
        \includegraphics[scale=0.5]{mysequence.pdf}
        \caption{File Upload Time-Sequence-Graph(Stevens)}
    \end{figure}
\end{enumerate}
\end{document}

