31.07.2015 Views

Download

Download

Download

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

20.2 THE TCP/IP PROTOCOL SUITE 647called a well-known port number. Well-known port numbers are in the range 1 to1024, for example, 53 (DNS) or 80 (HTTP); randomly assigned port numbers aregreater than 1024.A TCP connection between two sockets can be used to send data both ways (fullduplex).TCP Connections. TCP connections use sequencing of octets and acknowledgmentsof receipt to check for loss of data, to request retransmission of lost or corrupteddata, and to reassemble the user data at the destination. TCP is bit stream oriented sosequence numbers and acknowledgments refer to octets rather than segments.Acknowledgments consist of segments in which the Acknowledgment Numberfield contains the sequence number of the next octet expected by the sender of theacknowledgment (i.e., the sequence number of the last correctly received octetplus one), and where the ACK bit in the Control Bits field is set to 1 (to indicatethat the segment contains a valid acknowledgment). An acknowledgment segmentcan also carry user data.The logical connection between two TCP sockets is set up by synchronizing theirsequence numbers through an exchange of segments containing no user data andcalled a three-way handshake (Fig. 20.2-6). The originating host starts by sendinga segment with its initial sequence number in the Sequence Number field, andwith SYN ¼ 1 in the Control Bits field. The destination host responds with asegment in which:. The Acknowledgment Number field is set to the origination’s initial sequencenumber plus one (e.g., if the initial sequence number was 100, the AcknowledgmentNumber is 101).. The Sequence Number field is set to the destination’s initial sequence number.. The Control Bits field has ACK ¼ 1 and SYN ¼ 1.The originating host then completes the handshake by sending the third segment, inwhich the Acknowledgement Number field is set to the destination’s initial sequencenumber plus 1, and ACK ¼ 1.Once the two TCP entities are synchronized, the connection is established andreliable exchange of data begins. Reliable data delivery is achieved by a flowcontrol technique called windowing. Windowing allows a source to send a certainnumber of octets without acknowledgment, based on the value of the Windowfield set by the destination. After the set number of octets is sent, the source stopsand waits for an acknowledgment from the destination. The acknowledgmentrestarts the flow and also tells the source which octet to send next, thus allowingpacket retransmission if needed. The TCP entity at the destination reconstructsthe octet sequence and reassembles the original data. Figure 20.2-6 shows a connectionwith a Window value of three.The release sequence (Fig. 20.2-6) uses the FIN (finished) bit in the Control Bitsfield and starts when one side sends a segment with FIN ¼ 1. The receiving host

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!