tailieunhanh - Practical TCP/IP and Ethernet Networking- P30

Practical TCP/IP and Ethernet Networking- P30: The transmitter encodes the information into a suitable form to be transmitted over the communications channel. The communications channel moves this signal as electromagnetic energy from the source to one or more destination receivers. The channel may convert this energy from one form to another, such as electrical to optical signals, whilst maintaining the integrity of the information so the recipient can understand the message sent by the transmitter | Host-to-host transport layer protocols 127 Figure TCP connection establishment As mentioned before TCP generates pseudo-random sequence numbers by means of a 32-bit software counter that resets at boot-up and then increments every 4 microseconds. The host establishing the connection reads a value x from the counter where x can vary between 0 and 232 -1 and inserts it in the sequence number field. It then sets the SYN flag 1 and transmits the header no data yet to the appropriate IP address and port number. Assuming that the chosen sequence number was 132 this action would then be abbreviated as SYN 132. The receiving host . the server acknowledges this by incrementing the received sequence number by one and sending it back to the originator as an acknowledgment number. It also sets the ACK flag 1 to indicate that this is an acknowledgment. This results in an ACK 133. The first byte expected would therefore be numbered 133. At the same time the server obtains its own sequence number y inserts it in the header and also sets the SYN flag in order to establish a connection in the opposite direction. The header is then sent off to the originator the client conveying the message . SYN 567. The composite message contained within the header would thus be ACK 133 SYN 567. The originator receives this notes that its own request for a connection has been complied with and also acknowledges the other node s request with an ACK 568. Twoway communication is now established. Closing a connection An existing connection can be terminated in several ways. Firstly one of the hosts can request to close the connection by setting the FIN flag. The other host can acknowledge this with an ACK but does not have to close immediately as 128 Practical TCP IP and Ethernet Networking it may need to transmit more data. This is known as a half-close. When the second host is also ready to close it will send a FIN that is acknowledged with an ACK. The resulting situation is known as