Skip to content
- Tutorials
- Python Tutorial
- Taking Input in Python
- Python Operators
- Python Data Types
- Python Loops and Control Flow
- Python Functions
- Python OOPS Concept
- Python Data Structures
- Python Exception Handling
- Python File Handling
- Python Exercises
- Java
- Java Programming Language
- Java Collections
- Java 8 Tutorial
- Java Programs
- Java Interview Questions
- Java Exercises
- Java Quiz
- Java Projects
- Advance Java
- Programming Languages
- System Design
- Interview Corner
- Computer Science Subjects
- DevOps
- Linux
- Software Testing
- Databases
- Android
- Excel
- Mathematics
- Python Tutorial
- DSA
- Data Structures
- Algorithms
- Analysis of Algorithms
- Searching Algorithms
- Sorting Algorithms
- Greedy Algorithms
- Dynamic Programming
- Graph Algorithms
- Pattern Searching
- Recursion
- Backtracking
- Divide and Conquer
- Mathematical Algorithms
- Geometric Algorithms
- Bitwise Algorithms
- Randomized Algorithms
- Branch and Bound
- Algorithms Tutorial
- DSA Tutorial
- Practice
- All DSA Problems
- Problem of the Day
- Company Wise Coding Practice
- GfG SDE Sheet
- Practice Problems Difficulty Wise
- Language Wise Coding Practice
- Curated DSA Lists
- Competitive Programming
- Company Wise SDE Sheets
- DSA Cheat Sheets
- Top Interview Questions
- Puzzles
- Data Science
- Web Tech
- Courses
-
Last Updated : 13 Apr, 2023
Summarize
Comments
Improve
In TCP connection, flags are used to indicate a particular state of connection or to provide some additional useful information like troubleshooting purposes or to handle a control of a particular connection. Most commonly used flags are “SYN”, “ACK” and “FIN”. Each flag corresponds to 1 bit information.
Types of Flags:
- Synchronization (SYN) – It is used in first step of connection establishment phase or 3-way handshake process between the two hosts. Only the first packet from sender as well as receiver should have this flag set. This is used for synchronizing sequence number i.e. to tell the other end which sequence number they should accept.
- Acknowledgement (ACK) – It is used to acknowledge packets which are successful received by the host. The flag is set if the acknowledgement number field contains a valid acknowledgement number.
In given below diagram, the receiver sends an ACK = 1 as well as SYN = 1 in the second step of connection establishment to tell sender that it received its initial packet. - Finish (FIN) – It is used to request for connection termination i.e. when there is no more data from the sender, it requests for connection termination. This is the last packet sent by sender. It frees the reserved resources and gracefully terminate the connection.
- Reset (RST) – It is used to terminate the connection if the RST sender feels something is wrong with the TCP connection or that the conversation should not exist. It can get send from receiver side when packet is send to particular host that was not expecting it.
- Urgent (URG) – It is used to indicate that the data contained in the packet should be prioritized and handled urgently by the receiver. This flag is used in combination with the Urgent Pointer field to identify the location of the urgent data in the packet.
- Push (PSH) – It is used to request immediate data delivery to the receiving host, without waiting for additional data to be buffered on the sender’s side. This flag is commonly used in applications such as real-time audio or video streaming.
- Window (WND) – It is used to communicate the size of the receive window to the sender. The window size is the amount of data that the receiving host is capable of accepting at any given time. The sender should limit the amount of data it sends based on the size of the window advertised by the receiver.
- Checksum (CHK) – It is used to verify the integrity of the TCP segment during transmission. The checksum is computed over the entire segment, including the header and data fields, and is recalculated at each hop along the network path.
- Sequence Number (SEQ) – It is a unique number assigned to each segment by the sender to identify the order in which packets should be received by the receiver. The sequence number is used in conjunction with the acknowledgement number to ensure reliable data transfer and to prevent duplicate packets.
- Acknowledgement Number (ACK) – It is used to acknowledge the receipt of a TCP segment and to communicate the next expected sequence number to the sender. The acknowledgement number field contains the sequence number of the next expected segment, rather than the number of the last received segment.
Finish (FIN) v/s Reset (RST) –
- Push (PSH) – Transport layer by default waits for some time for application layer to send enough data equal to maximum segment size so that the number of packets transmitted on network minimizes which is not desirable by some application like interactive applications(chatting). Similarly transport layer at receiver end buffers packets and transmit to application layer if it meets certain criteria.
This problem is solved by using PSH. Transport layer sets PSH = 1 and immediately sends the segment to network layer as soon as it receives signal from application layer. Receiver transport layer, on seeing PSH = 1 immediately forwards the data to application layer.
In general, it tells the receiver to process these packets as they are received instead of buffering them. - Urgent (URG) –Data inside a segment with URG = 1 flag is forwarded to application layer immediately even if there are more data to be given to application layer. It is used to notify the receiver to process the urgent packets before processing all other packets. The receiver will be notified when all known urgent data has been received.
Push (PSH) v/s Urgent (URG) –
Please Login to comment...
Similar Reads
How Many Bits are Reserved for the TCP Flags?
Transmission Control Protocol (TCP) is a transport layer protocol. TCP makes packet transmission from source to destination smoother. It is a connection-oriented and end-to-end protocol. Each data packet is wrapped in a header by TCP, which consists of 10 mandatory fields totaling 20 bytes and an optional data field of 0 to 40 bytes. Here, we'll lo
3 min read
How Many Flags in TCP Header?
Answer: TCP header consists of six flags, where each flag is one bit long. TCP header consists of six flags that are used for controlling the flow of data for specific scenarios. Each flag in TCP header is one bit long. Below are the flags available in TCP header. List of TCP flagsUrgent Flag: Urgent Flag is know as URG flag. If one bit value is se
2 min read
TCP with explicit link failure notification (TCP-ELFN)
TCP with Explicit Link Failure Notification (TCP-ELFN) is an end to end approach used in TCP Ad Hoc wireless networks to improve the performance by decoupling the path break information from congestion information. TCP-ELFN does not depend upon any routing protocols as it requires explicitly only the link failure notification when there is a path f
2 min read
TCP Tahoe and TCP Reno
TCP is known as a connection-oriented protocol, which ensures reliability and is also responsible for congestion control mechanisms in the network. TCP Tahoe and TCP Reno are two techniques of TCP congestion control, these are used when the sender receives three duplicate acknowledgments. TCP Tahoe where Tahoe is a lake in the USA. This particular
4 min read
TCP Fast Open and TCP/IP Acceleration
The TCP Fast Open (TFO) and TCP/IP Acceleration are techniques used to improve the performance and efficiency of TCP connections in computer networks. These techniques aim to reduce the latency and improve the throughput of the TCP connections, especially for short-lived connections and web browsing scenarios. TCP Fast Open (TFO): The TCP Fast Open
3 min read
Basic concept of TCP-Vegas
TCP Reno and TCP Tahoe models can determine the congestion in the network only when there some packet loss occurred in the system. So in these models, we have compensated for the packet to sense the congestion in the network. In these models when packet loss occurs the window size is decreased and the system enters the congestion avoidance phase. W
3 min read
TCP Server-Client implementation in C
Prerequisites - Socket Programming in C/C++, TCP and UDP server using select, UDP Server-Client implementation in C If we are creating a connection between client and server using TCP then it has a few functionalities like, TCP is suited for applications that require high reliability, and transmission time is relatively less critical. It is used by
4 min read
TCP Connection Establishment
Prerequisite – TCP 3-Way Handshake Process TCP is a connection-oriented protocol and every connection-oriented protocol needs to establish a connection in order to reserve resources at both the communicating ends. Connection Establishment - 1. Sender starts the process with the following: Sequence number (Seq=521): contains the random initial seque
3 min read
What is TCP Window Scaling?
In the TCP header, the window size field is of size 16 bits. Using this field TCP users (client or server) can advertise a maximum of 216 = 65536 bytes or 64 KiB as its buffer size to its other end-user. But modern endpoint devices (e.g., phones, tabs, PCs, etc) have much more memory available in their buffers. This 16-bit field was enough during t
5 min read
Wrap Around Concept and TCP Sequence Number
Prerequisite - TCP | Services and Segment structure Transmission Control Protocol (TCP) is one of the most important protocols of the internet protocol. It provides full transport-layer service to applications and generates a virtual circuit between sender and receiver that is active for the duration of the transmission. Its segment consists of a T
6 min read
Devices used in each layer of TCP/IP model
Prerequisite - TCP/IP Model, Network Devices 1. Physical Layer - Physical layer of TCP/IP model is responsible for physical connectivity of two devices. Some of the devices used in Physical layers are, Hubs: Hubs are devices commonly used to connect segments of a LAN. It contains multiple input/output ports. when signal is at any input port, this s
4 min read
TCP and UDP in Transport Layer
Layer 3 or the Network layer uses IP or Internet Protocol which being a connection less protocol treats every packet individually and separately leading to lack of reliability during a transmission. For example, when data is sent from one host to another, each packet may take a different path even if it belongs to the same session. This means the p
4 min read
OSI, TCP/IP and Hybrid Models
OSI Model is developed by International Organization for Standardization or ISO, the Open Systems Interconnection model or OSI model is a critical building block in networking. OSI Model helps in troubleshooting and understanding networks because of the layered approach that it follows. It consists of seven layers in which each layer has its functi
4 min read
Traditional TCP
Transmission Control Protocol (TCP) is the transport layer protocol that serves as an interface between client and server. The TCP/IP protocol is used to transfer the data packets between transport layer and network layer. Transport protocol is mainly designed for fixed end systems and fixed, wired networks. In simple terms, the traditional TCP is
4 min read
Calculation of TCP Checksum
In this article, we will learn a good concept of how the TCP/UDP checksum is calculated. When we receive data from the application it is broken into smaller data parts as the whole data from the application cannot be sent through the network to the receiver host. The protocol we use in OSI in the Transport layer is TCP. So, after breaking the data
4 min read
TCP/IP in Computer Networking
Introduction : TCP/IP (Transmission Control Protocol/Internet Protocol) is a suite of communication protocols that define the standards for transmitting data over computer networks, including the internet. The TCP/IP protocol is the foundation of the internet and enables devices to communicate with each other using a common language. The TCP/IP pro
8 min read
Various TCP and UDP ports
Transportation layer conventions utilize the idea of ports and multiplexing/demultiplexing to convey information to individual services listening on network nodes. These ports are spoken to by a solitary 16-bit number, implying that they can constitute a range of numbers 0-65535. This range has been separated by the IANA (Internet Assigned Numbers
4 min read
How to calculate Maximum Segment Size in TCP?
Maximum Segment Size refers to size of the largest segment that local host accepts within a single packet. It denotes largest amount of data that host can accept in single TCP segment. For establishing the TCP connection, both sender and receiver indicates Maximum Segment Size they can accept. While transmitting the packets over TCP connection send
3 min read
Vegas A ( Modified TCP-Vegas )
Vegas A is the modification of TCP Vegas. The A in Vegas A stands for adaptive.TCP Vegas has a fixed value of the constant alpha and beta. So it does not do better when it is in connection with TCP Reno. Therefore, in Vegas A these constants are not fixed but change according to the throughput and the extra data in the queue. In the starting, the v
4 min read
Construct a simple HTTP request on TCP protocol
HTTP Request : HTTP messages are how data is exchanged between a server and a client. In this, there are two types of messages where one is HTTP client request and the second is the response from the server.Messages in textual form and it is encoded in ASCII form, and span over multiple lines. And messages were openly sent across the connection in
3 min read
Similarities between TCP/IP model and OSI model
Pre-Requisite: Layers of OSI Model, TCP/IP Model OSI Model or Open Systems Interconnection is an architecture of 7 layers in which each layer has its work to perform whereas TCP/IP is a concise version of the OSI Model. TCP/IP Model consists of 4 layers rather than the 7 layers of the OSI Model. There are so many similarities between the TCP/IP mod
5 min read
Fast Recovery Technique For Loss Recovery in TCP
When the RTO timer expires but an ACK is not received, the sender confirms that the packet is lost due to congestion at intermediary devices. Now sender has to tackle this congestion state carefully. Fast Recovery is the packet loss recovery technique. Recovery means becoming inactive and not transmitting any new packet for some time. When there is
4 min read
Snooping TCP
In this article, we will discuss the overview of Snooping TCP, and its working, and then will discuss the advantages and disadvantages of Snooping TCP. Let's discuss it one by one. Overview :Snooping TCP is one of the classical TCP improvement approaches. This approach is designed to solve the end-to-end semantics loss in I-TCP. The basic concept i
3 min read
Selective Acknowledgments (SACK) in TCP
When a packet loss is detected in TCP communication between client and server, the next step is to recover the lost data packet. There are some of the algorithms for loss recovery in TCP. These are: Fast RecoverySelective Acknowledgments (SACK)Proportional Rate Reduction (PRR)Limitations of Fast Recovery:The ‘Fast Recovery’ mechanism in TCP Reno ha
5 min read
TCP vs UDP for Video Streaming
Prerequisite : TCP/IP Model, User Datagram Protocol (UDP)In this era of the modern internet with entertainment, education, gaming and all kinds of necessities streaming live everyday, the demand of an uninterrupted video stream is highly adamant. To dive into the topic of which protocol is better for video streaming, one must be familiar with the T
6 min read
Examples of TCP and UDP in Real Life
Today we will see the Real-Life Examples of TCP and UDP in Computer Networks Before looking at the Real-Life Examples of TCP and UDP, Let's see What is Computer Network? A Computer Network is a set of devices (Nodes) that are connected to each other by communication links to share digital information.The communication links can either be wireless m
8 min read
Why is YouTube using TCP but not UDP?
Overview :In this article, we will discuss about which technology YouTube uses for streaming videos and music on its platform. YouTube is an American online video sharing and web-based media stage by Google. It is most utilized sites in the entire world. YouTube is a free video-facilitating site that permits individuals to store and serve video con
3 min read
Why does Netflix use TCP but not UDP for streaming video?
Overview :In this article, we will discuss which technology Netflix uses for streaming online movies and web series on its platform. Netflix is an American subscription-based streaming service provider company. It is famous for streaming online videos, web series, and movies based on its subscription that its customers buy. There are two types of t
3 min read
When Transmission Control Protocol (TCP) most appropriate?
TCP(Transmission Control Protocol) is a protocol of the Transport layer. TCP is a connection-oriented, reliable, and secured protocol. To provide reliable service TCP implements Error control, Congestion control, Flow control. Services provide by TCP : The process to process communication -It is achieved using the port number.Stream Delivery Servic
2 min read
TCP Reno with Example
TCP Reno is an integral part of TCP protocols responsible for congestion control in the network. TCP Reno is an extension of TCP Tahoe (the first in-built congestion control algorithm). TCP Reno = Slow Start + AIMD + Fast Retransmit + Fast Recovery Working of TCP Reno Assumption: The sender has unlimited data to sendinitcwnd = 10 segmentsPackets 3
5 min read
Article Tags :
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id, check: true }), success:function(result) { jQuery.ajax({ url: writeApiUrl + 'suggestions/auth/' + `${post_id}/`, type: "GET", dataType: 'json', xhrFields: { withCredentials: true }, success: function (result) { $('.spinner-loading-overlay:eq(0)').remove(); var commentArray = result; if(commentArray === null || commentArray.length === 0) { // when no reason is availaible then user will redirected directly make the improvment. // call to api create-improvement-post $('body').append('
'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id, }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.unlocked-status--improve-modal-content').css("display","none"); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); return; } var improvement_reason_html = ""; for(var comment of commentArray) { // loop creating improvement reason list markup var comment_id = comment['id']; var comment_text = comment['suggestion']; improvement_reason_html += `
${comment_text}
`; } $('.improvement-reasons_wrapper').html(improvement_reason_html); $('.improvement-bottom-btn').html("Create Improvement"); $('.improve-modal--improvement').hide(); $('.improvement-reason-modal').show(); }, error: function(e){ $('.spinner-loading-overlay:eq(0)').remove(); // stop loader when ajax failed; }, }); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); } else { if(loginData && !loginData.isLoggedIn) { $('.improve-modal--overlay').hide(); if ($('.header-main__wrapper').find('.header-main__signup.login-modal-btn').length) { $('.header-main__wrapper').find('.header-main__signup.login-modal-btn').click(); } return; } } }); $('.left-arrow-icon_wrapper').on('click',function(){ if($('.improve-modal--suggestion').is(":visible")) $('.improve-modal--suggestion').hide(); else{ $('.improvement-reason-modal').hide(); } $('.improve-modal--improvement').show(); }); function loadScript(src, callback) { var script = document.createElement('script'); script.src = src; script.onload = callback; document.head.appendChild(script); } function suggestionCall() { var suggest_val = $.trim($("#suggestion-section-textarea").val()); var array_String= suggest_val.split(" ") var gCaptchaToken = $("#g-recaptcha-response-suggestion-form").val(); var error_msg = false; if(suggest_val != "" && array_String.length >=4){ if(suggest_val.length <= 2000){ var payload = { "gfg_post_id" : `${post_id}`, "suggestion" : `
${suggest_val}
`, } if(!loginData || !loginData.isLoggedIn) // User is not logged in payload["g-recaptcha-token"] = gCaptchaToken jQuery.ajax({ type:'post', url: "https://apiwrite.geeksforgeeks.org/suggestions/auth/create/", xhrFields: { withCredentials: true }, crossDomain: true, contentType:'application/json', data: JSON.stringify(payload), success:function(data) { jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-section-textarea').val(""); jQuery('.suggest-bottom-btn').css("display","none"); // Update the modal content const modalSection = document.querySelector('.suggestion-modal-section'); modalSection.innerHTML = `
Thank You!
Your suggestions are valuable to us.
You can now also contribute to the GeeksforGeeks community by creating improvement and help your fellow geeks.
`; }, error:function(data) { jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Something went wrong."); jQuery('#suggestion-modal-alert').show(); error_msg = true; } }); } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Minimum 5 Words and Maximum Character limit is 2000."); jQuery('#suggestion-modal-alert').show(); jQuery('#suggestion-section-textarea').focus(); error_msg = true; } } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Enter atleast four words !"); jQuery('#suggestion-modal-alert').show(); jQuery('#suggestion-section-textarea').focus(); error_msg = true; } if(error_msg){ setTimeout(() => { jQuery('#suggestion-section-textarea').focus(); jQuery('#suggestion-modal-alert').hide(); }, 3000); } } document.querySelector('.suggest-bottom-btn').addEventListener('click', function(){ jQuery('body').append('
'); jQuery('.spinner-loading-overlay').show(); if(loginData && loginData.isLoggedIn) { suggestionCall(); return; } // load the captcha script and set the token loadScript('https://www.google.com/recaptcha/api.js?render=6LdMFNUZAAAAAIuRtzg0piOT-qXCbDF-iQiUi9KY',[], function() { setGoogleRecaptcha(); }); }); $('.improvement-bottom-btn.create-improvement-btn').click(function() { //create improvement button is clicked $('body').append('
'); $('.spinner-loading-overlay').show(); // send this option via create-improvement-post api jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.improvement-reason-modal').hide(); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); });