Hot answers tagged

211

Break down the handshake into what it is really doing. In TCP, the two parties keep track of what they have sent by using a Sequence number. Effectively it ends up being a running byte count of everything that was sent. The receiving party can use the opposite speaker's sequence number to acknowledge what it has received. But the sequence number doesn't ...


61

Interesting perspective and question! Yes, most of what UDP does is supply a standard means for multiple applications to co-exist using the same IP address, by defining the concept of UDP ports. The exciting part about UDP isn't so much the network protocol but the API implemented by operating systems and socket libraries. While not part of the UDP ...


46

UDP is a transport protocol, like TCP. That means it provides a protocol for an application to use IP. Like TCP, UDP has addressing (ports) to which applications bind so that datagrams destined to bound applications get sent by UDP to the correct applications. UDP for IPv4 also provides an optional checksum, but the checksum is required for IPv6. UDP is a ...


33

The MTU is the Maximum IP packet size for a given link. Packets bigger than the MTU is fragmented at the point where the lower MTU is found and reassembled further down the chain. If no fragmentation is wanted, either you have to check the MTU at each hop or use a helper protocol for that (Path MTU Discovery). Note that IPv6 does NOT support packet ...


28

The short answer is no, that's not the limit. A TCP Port field is 2x bytes and holds a quantity of 65536. This number limits the amount of addresses a server can have. But this doesn't limit the number of clients to ~64k. Each TCP Packet has two Port fields one for the destination and one for the source (as well as two IP addresses). A given TCP ...


27

If you are asking in a general sense, then the answer is most definitely "yes", any HTTP method (like POST) requires a TCP connection, and the only way to initiate a TCP connection is to use the three way handshake. IF, however, you are asking in a specific case, maybe if you are capturing your own traffic and don't see the 3 way handshake after ...


26

The three-way handshake is necessary because both parties need to synchronize their segment sequence numbers used during their transmission. For this, each of them sends (in turn) a SYN segment with a sequence number set to a random value n, which then is acknowledged by the other party via a ACK segment with a sequence number set to n+1.


26

The TCP window size is generally independent of the maximum segment size which depends on the maximum transfer unit which in turn depends on the maximum frame size. Let's start low. The maximum frame size is the largest frame a network (segment) can transport. For Ethernet, this is 1518 bytes by definition. The frame encapsulates an IP packet, so the largest ...


24

In addition, MSS value is derived from the MTU. Consider that you have data of 2260 bytes to be sent to a remote device. If MTU is 1500, and we consider IP header + TCP header to be 40 bytes, then only 1460 bytes of data can be sent in the first IP packet. The remaining 800 bytes will be sent in the second IP packet. So, for MSS = 800, the MTU should be at ...


24

This part of the RFC is about passing responsibility over to the operating system or whatever is the next stage of the process. It's fundamentally concerned with the separation of layers. An acknowledgment by TCP does not guarantee that the data has been delivered to the end user, but only that the receiving TCP has taken the responsibility to do so. I ...


23

In order for the connection to work, each side needs to verify that it can send packets to the other side. The only way to be sure that you got a packet to the other side is by getting a packet from them that, by definition, would not have been sent unless the packet you sent got through. TCP essentially uses two kinds of messages for this: SYN (to request ...


23

IP is a Layer 3 protocol. TCP/UDP are Layer 4 protocols. They each serve different purposes. Layer 3 is in charge of end to end delivery. Its sole function is adding whatever is necessary to a packet to get a packet from one host to another. Layer 4 is in charge of service-to-service delivery. Its sole function is to segregate data streams. Your computer ...


22

One of my buddies is saying that TCP will be a problem for this gateway because it is going to establish a new connection for every message it sends (not kafka but the underlying transportation protocol itself is the issue), requiring a new port each time. At the rate we'll be sending these clients messages (gigabytes), kafka will run out of ports to read ...


17

Because you're looking at the UDP Datagram, which is the payload in an IP Datagram. The IP Header has the src/dst IP addresses.


17

TCP/IP sockets establish an end-to-end connection through the network, between two specifically addressed end points. BGP uses TCP/IP to communicate between routers (any devices exchanging routing information.) The information exchanged is used by the BGP peers, to better choose the way they choose where to send, (aka, next-hop) packets that they need to ...


15

No, a TCP connection is uniquely identified by both source and destination IP and TCP (port) addresses. Changing any one of those will break the TCP connection (or prevent it from forming in the handshake). What you may be referring to is the fact that a web browser will form, use, and close multiple TCP connections with the web server. Each connection will ...


14

Routing protocols do not "achieve" L3 connectivity. They populate the routing (forwarding) table of the router with information learned from other routers. BGP is an "application" that runs over TCP/IP. In other words a BGP router uses TCP/IP to communicate with other BGP routers to exchange routing information. In order for BGP to work, you must ...


14

I would encourage you to look at how higher level protocols that utilize UDP actually use it. Classic and well documented examples are DNS (in most cases at least, it's possible to do DNS over TCP but it's really uncommon), DHCP, NTP, and PTP. All of these protocols have some specific things in common: They care about being able to coexist with other ...


13

Does that make any sense? No. The FIN is send because the sender decided that it wants to close the connection. Even if you would change the recipient that it will ignore the FIN the sender side of the application will still consider the connection closed and not send or receive any more data on it. Just compare it to a phone call. If the other end ...


12

Both HTTP GET and HTTP POSTS use TCP. If you are asking whether a POST also requires a 3-way TCP handshake (syn-synack-ack), it does just like any other TCP connection. The TCP handshake is required before any application protocol (such as HTTP) starts work. FYI, your three-way handshake is incorrect; it should be "syn-synack-ack" ADD: If browser use ...


12

NAT works at layer 3 because it is modifying the IP header. If you use PAT you could argue that it is working at layer 4 as well because it MIGHT change the source port of the packet in case it is not unique. Several internal addresses can be NATed to only one or a few external addresses by using a feature called Port Address Translation (PAT) which is also ...


12

What happens at the time-out is actually pretty clear from the drawing... The congestion window size drops back to its original value of 1 and slow start is run again. The specifics of how a TCP stack will handle congestion events depend on what variant you are using. This drawing looks like an example of the TCP Reno algorithm. When seeing 3 duplicate ...


12

First, I'm assuming you're focused on TCP. UDP has some differences, and I'm not as up-to-speed on that part. I’m beginning to learn about nat and I was wondering why does NAT translate a source port? You're right to ask this question, and to be frank, it doesn't always need to. However, sometimes that translation IS required. Given that it is ...


11

In normal TCP behavior, they should never both be set to 1 (on) in the same packet. There are many tools that exist that let you craft TCP packets, and the typical response to a packet with SYN and FIN bits set to one is a RST, since you are violating the rules of TCP.


11

I teach TCP, and I often run into people who were mis-taught that the ACK is only sent when the Window Size is reached. This is not true. (To be really transparent, I too taught this incorrectly before I knew better as well, so I completely understand the mistake). NOTE, I'll be using Receiver/Sender to describe it, but keep in mind TCP is bidirectional, ...


11

1. What goes into setting the MSS? In the question you referenced it stated this, the MSS is derived directly from MTU. A typical Ethernet MTU will 1500, but IP and TCP headers must also be taken into account - each of them are 20 bytes. Note: Just an FYI, MTU can be different sizes - see Jumbo Frames for an example. We end up with: MSS = 1500 - 20 - ...


11

User applications use random ephemeral ports for outgoing connections. TCP port 80 is only the server side's default port for WWW. A TCP socket connection consists of source IP, source port, destination IP, destination port. Only if all of these are identical it's the same socket.


10

Every "header" has some sort of "Next Protocol" identification field. This is necessary because on the wire, the data is nothing but a string of 1's and 0's. The receiving endpoint must have a way of interpreting what the next bits refer to. If not for such a field which definitively indicates how to interpret the next set of 1's and 0's, there would be ...


10

Transport of both UDP and TCP packets from one router to the next is done at the IP layer and solely based on the information at this layer. This means, that there is no distinction between UDP and TCP and in both cases change of path, congestion or router hickups can cause loss, duplication or reordering of packets. But, contrary to UDP, TCP can deal with ...


10

You asked a good question. Don't let anyone tell you otherwise. Regrettably, there is no rule of thumb for the types of protocols that use TCP verses the types of protocols that use UDP. The decision whether a protocol uses one or the other come down to whomever wrote/created the protocol to begin with. If they didn't want to bother with writing their own ...


Only top voted, non community-wiki answers of a minimum length are eligible