Transport Layer
What is port number and what is its use?
A socket is the interface through which a process communicates with the transport layer. A socket must have a unique identification. Port number is a 16 bit binary number 0-65535 some addresses to the application layer.
What is congestion control in TCP?
Congestion control is a method of ensuring that everyone across a network has a "fair" amount of access to network resources, at any given time. In a mixed-network environment, everyone needs to be able to assume the same general level of performance. A common scenario to help understand this is an office LAN. You have a number of LAN segments in an office all doing their thing within the LAN, but then they may all need to go out over a WAN link that is slower than the constituent LAN segments. Picture having 100mb connections within the LAN that ultimately go out through a 5mb WAN link. Some kind of congestion control would need to be in place there to ensure there are no issues across the greater network.
What is flow control in TCP?
Flow control is controlled by the receiving side. It ensures that the sender only sends what the receiver can handle. Think of a situation where someone with a fast fiber connection might be sending to someone on dialup or something similar. The sender would have the ability to send packets very quickly, but that would be useless to the receiver on dialup, so they would need a way to throttle what the sending side can send. Flow control deals with the mechanisms available to ensure that this communication goes smoothly.
Reliable data transfer protocol
Reliable Data Transfer over a Perfectly Reliable Channel. Reliable Data Transfer over a Channel with Bit Errors problem:bits in a packet may be corrupted. Solution:Error detection checksum,Receiver feedback(ACK,NAK) and retransmission -Bit fail: Failure in ACk. Solution: (Stop and wait) Duplicate packet. Soln: Sequence number complex. Soln: drop NAK and send the ack for the last correct received packet. Loss of packet: prob: stop and wait. soln :use timer.
TCP has header length but UDP doenot have a header length why?
TCP uses acknowledgements to provide reliable transport, whereas UDP does not provide reliable transport. So TCP needs a sequence number and acknowledgement number, but UDP does not. Because of the options, TCP header lengths vary. Thus, TCP needs the header length field to allow the receiver to separate the end of the header from the data. UDP has no options,
Define TCP header
Source and Destination Ports: Both source and destination ports are 16-bit fields identify protocol ports of the sending and receiving applications. The source and destination port numbers plus source and destination IP addresses in the IP header combine to uniquely identify each TCP connection referred as a socket. Sequence Number: Sequence number is a 32-bit wide field identifies the first byte of data in the data area of the TCP segment. We can identify every byte in a data stream by a sequence number. Acknowledgement Number: Acknowledge number is also a 32-bit wide field which identifies the next byte of data that the connection expects to receive from the data stream. Header Length: Header length is a field which consists of 4 bit to specifies the length of the TCP header in 32-bit words. Receiving TCP module can calculate the start of the data area by examining the header length field. Flags: URG - URG flag tells the receiving TCP module as it is urgent data ACK - ACK tells the receiving TCP module that the acknowledge number field contains a valid acknowledgement number PSH - PSH flag tells the receiving TCP module to immediately send data to the destination application RST - RST flag asks the receiving TCP module to reset the TCP connection SYN - SYN flag tells the receiving TCP module to synchronize sequence number FIN - FIN flag tells the receiving TCP module that the sender has finished sending data Window Size: Window size field is a 16-bit wide which tells the receiving TCP module the number of bytes that the sending end id willing to accept. The value in this field specifies the width of the sliding window. Checksum: TCP checksum is a 16-bit wide filed includes the TCP data in it's calculations. This field helps the receiving TCP module to detect data corruption. That is, TCP requires the sending TCP module to calculate and include checksums in this field and receiving TCP module to verify checksums when they receive data. The data corruption is detected in this way. Urgent pointer: Urgent pointer is a 16-bit wide field specifies a byte location in the TCP data area. It points to the last byte of urgent data in the TCP data area. Options: TCP header includes an optional options field like the IP header. During the initial negotiations between two ends of a TCP connection, this field is used with maximum segment size option, which advertise the largest segment that the TCP module expects to receive.
What is the difference between UDP and TCP
TCP is connection oriented protocol a message makes its way across the internet from one computer to the another and UDP is the connecionless protocol and is used in message transport. TCP is suited for the application that requires high reliability and transmission time is relatively critical. UDP is suited for application that need fast efficient transmission. HHTP, FTP telnet is eg of TCP. DNSDHCP TFTP is the eg of UDP. TCP arrages data packets in the ordered specified. UDP has no order and all message is independent of each order. TCP is slower than UDP. there is absolute gurantee if the data packet. TCP does flow control and congestion control. Error checking and ack in aTCP.
What does it mean when we say that TCP is pipelined?
TCP uses the concept of sliding windows when sending segments. It also maintains record of each segment if it is received at the other end or not using ACKS. Hence, we can say when a segment is sent, it is in the pipeline until its ACK is received. If the the ACK is not received, we will do a retransmission, hence keeping it in the pipeline.
why TCP is a fair protocol?
TCP(All variations in use todays Internet) uses AIMD(Additive Increase Multiplicative Decrease) algorithm, which ensures fairness. How? Because hosts increase their bandwidth additively, but when congestion occurs they drop their bandwidth multiplicatively. So, the host with higher share, loses most. After that every host increase their share by same amount(additivitely). As this steps happens again and again, bandwidths converge to fair amounts.
How does TCP realize the reliable data transportation over an unreliable IP protocol?
The medium over which data is sent, is always unreliable. TCP promises reliability by making sure that data reached its intended destination (over unreliable medium). It achieves this by Acknowledgments (ACKs). When TCP receives data from upper layer (Application Layer), it chunks the data into segments and appends its own header. This header assigns a unique segment no. to this chunk of data. When this chunk is received by the recipient, it replies to the sender by telling next sequence of data that it is expecting to receive. There may be no. of reasons why ACK is not received by the sender: 1. Data was lost mid way, and hence destination did not receive it at all. 2. Data was corrupted and destination was not able to make sense out of it. 3. ACK was lost. 4. Destination process closed without intimating the sender, etc., etc. If this ACK is not received by the sender within a certain interval (called timeout interval), sender resends this data and resets timeout interval. It keeps on trying until it gives up after a certain no. of timeouts. Both sender and destination use a unique random initial sequence no. for this purpose. This sequence no. represents the next byte of data that other side is expecting. Sender also sends an ACK for each ACK sent by destination, to tell destination that "I know that you received the data". Host (Sender/Client) need not send pack a special packet for ACK, it can piggyback this ACK along with next chunk of segment to be sent. On the other hand, if ACK is successfully received, the sender is sure that data was received by the destination. The following diagram should make some sense now
Define multiplexing and demultiplexing. How multiplexing and demultiplexing is done in TCPIP
The transport layer receives a sequence of the segments from its network layer and delivering segments to the correct socket is called demultiplexing whereas assembling segments with the necessary information and passing them to the network layer is called multiplexing.