Internet applications like ftp and email normally use TCP because it offers reliable byte-stream service. Applications with very little requirements based on the Trivial File Transfer Protocol, use UDP.
|Reliable Protocol||Connection||Checksum||Data Service||virtual circuits|
A port is like an IP address except that TCP/IP associates a port with a protocol rather than a host computer. In the same way that IP datagrams store source and destination IP addresses, transport protocols store source and destination port numbers.
Each application, regardless of whether it is a server or a client, has a unique port number. Whenever a client sends a message, the transport layer automatically inserts the correct port number within the source port field. When a server program is created, a request can be made to the network for a port number.
The commonly used applications of ftp, telnet, and mail use well-known port assignments, that is, port assignments that are commonly used for specific Internet applications or functions.
|protocol||well-known port assignment|
Initially, the employee (application protocol) assigned to the number (port) always receives the incoming call (connection). If the employee and the caller agree to talk to each other, a conversation (exchange of data) ensues.
The employee (application protocol) can have another employee (application protocol) pick up the same telephone line (phone0 and share the caller's information (establish another connection using the same port). It can alos transfer the call to ararely used line (port) and continue the exchange of data without interrruption.
UDP is similar to IP in that both are unreliable, connectionless protocols that use datagrams for data delivery.
Unlike the IP checsum, the UDP checksum includes the data area in the calculations. However, theprotocol does not require that the checksum will be calculated. The TCP and IP, on the other hand, require that the calculation will take place.
More complex than UDP because it provides a reliable, byte-stream, connection-oriented data deliver syervice. It also tries to optimize bandwidth. To optimize network throughput, TCP dynamically controls the flow of data between connections. As such, if the data transfer at the receiving end of the TCP connection starts to overflow, TCP will tell the sending end to reduce transmition speed.
Note TCP is reliable, connection-oriented, byte-based, but it works with IP that is connectionless, unreliable, datagram-based.
To ensure reliability and byte-streem sequencing, TCP uses acknowledgments. The reciever sends acknowledgement for each message it gets, and the sender resends each message for which it didn't get an acknowledgement in due time.
To improve throughhput, TCP does not send a message and then wait until it receives an acknowledgement before transmitting another. Instead, TCP uses a concept called a sliding window, which lets TCP transmit several messages berore waits for acknowledment. It sends a group of messages, and then add new transmitions when acknowldgements to old ones arrive.
TCP can increase or reduce the width of the window in response to the load oin the internet.
Window sizes are specified in bytes.
TCP segment structure:
Telnet applications normally set this flag. By doing so, telnet forces TCP to immediately pass the user's keyboard inputs to the telnet server. This helps eliminate dalays in echoing the received character back to the sender.
To establish a TCP connection, both ends of the connection must negotiate and agree to use packet indentefication information that the other end understands. Likewise, the network must somehow synchronize the receiving end of the TCP connection with the sending end.
Each time a program wants to use TCP to transport data, it transmits a request for a TCP connection to the computer's transport layer. The TCP module in the transport layer, in turn, sends a TCP message with a Synchronization (SYN) flag and a sequence number to the remote port to which the program wants to connect. The SYN flag tells the receiver that a connection is requested, and the sequence number tells how the data will be identified.
The receiver replies with an ACK flag, an Acknowledge number, and a sequence number. The sequence number of the receiver is independent of that of the sender. Both sequence numbers are needed because the TCP connections are full-duplex, that is, data flows both directions at the same time.
The Acknowledgement number is built out of the sequence number of the client. It is the next sequence number that the connection exopects to receive. As such, in its intial reply message, the server side TCP module stores the client side sequence number plus one.
Before it transfer data, the client-side TCP module must acknowledge the initial reply message from the server-side TCP module. The acknowledment is for the server's request for synchronization.
After this three-way handshake, the client and server have their sequence numbers synchronoized. That is, they have all the information they need to identify data in the communication channel.
From then on, the sequence numbers are increased by the size of the data being transmitted. For a transmition of 2000 bytes in four chunks of 500 bytes, we get
Is done using a two-way handshake. To close a connection, a message with the Finish flag FIN on is sent. An acknoledgement means that both sides agree to the closure. That is, to close a connection, we need an active close from the initiator an a passive close from the partner.
Since the communication is two-way in a full-duplex mode, closing a communication in one direction still leaves the one in the other direction openned.