ChatSite mapSearchHelp
 

The site
Internet
Brief history
Basic concepts
Connection
Website making
Guestbook

Resources
About us
Contact us

Dial-up networking fundamental
Dial-up protocolsUnderstanding TCP/IPIP classes
Subnet masksDynamic IP addressingDomain name resolution
Domain name systemTCP structureTCP features
Structure of a TCP segment

       When a TCP application sends a data, it divides into number of  TCP segments. These segments include part of the data along with the header that  defines various parameters used in the TCP communication between the source and the destination. These TCP segments are  then encapsulated within the data portion of an IP datagram and sent on their way. If TCP are sent inside IP datagrams, and I just said that IP is unreliable.

How can TCP possibly be reliable?

       The trick is that, unlike straight IP, TCP expects a response from its TCP computer on receiving end. Think of this way: Imagine mailing a letter again!!, to someone and including a Post-it Note on the letter that specifies your phone number and tells the recipient to call you when she receives the letter. If  you don't hear from her, you know she didn't get the letter. To ensure reliable communication, TCP includes a "Post-it Note" in its header that does two things:

  • When the application requests that the data be sent a remote location, TCP constructs an initial segment that attempts to set up the socket interface between the two systems. No data is sent until TCP hears back from the receiving system that the sockets are in place and that's ready to receive the data.
  • When the sockets are ready to go, TCP starts sending within its segments and always asks receiving TCP to acknowledge that these data segments have arrived.If no acknowledgement is received, the sending TCP retransmits the segments.
  • Here is the exact format of TCP header.

    Field

    Bits

    Description

    Source Port

    0 to 15

    The source port number
    Destination Port

    16 to 31

    The destination number
    Sequence Number

    32 to 63

    In the overall sequence of bytes being sent, this field specifies the position in this sequence of the segment's first data byte.
    Acknowledgement

    64 to 95

    In the ACK control Bit is set, this field contains the value of the next sequence number the sender of the segments is expecting the receiver to acknowledge.
    Data Offset

    96 to 99

    The length of the TCP segment header, in 32 bit words.This tells the   receiving socket where the data starts.
    Reserved

    100 to 105

    This field is reserved for future use!
    Control Bits

    106 to 111

    Those codes specify various aspects of the communication.When set to 1, each bit controls a particular code as listed here:

    106 URG: Urgent pointer field significant.

    107 ACK:Acknowledgment Number field to be used.

    108 PSH: Push Function.

    109 RST: Reset the connection.

    110 SYN: Synchronize sequence numbers.This bit is set when the connection is opened.

    111 FIN: No more data form sender, so close the connection.

    Windows

    112  to 127

    The number of data bytes that the sender can currently accept. This sliding window lets the sender and the receiver vary the number of bytes sent and thus increase efficiency.
    Checksum

    128 to 143

    This value lets the receiver determine the integrity of the data.
    Urgent Pointer

    144 to 159

    If the URG control bit is set, this field indicates the location in the data where the urgent resides.
    Options

    160 and over

    This variable-length field specifies extra TCP options such as the maximum segment size.

    copyright.gif (2188 bytes)