Torrent Port Forward Tcp Udp Differences

Posted onby
  1. Udp Or Tcp

Improving torrent speeds. It is also worth noting that if you port forward through a VPN service your connection remains securely encrypted by the VPN. UDP vs TCP: What's the difference? Last updated: November 28, 2018. Drummerdave4689 on January 12, 2019. You shouldn't need to forward any ports since it's an outgoing connection. RTMP uses 1935 TCP. You can open (forward) some TCP or UDP ports for troubleshooting. Ports are endpoints between two connections. A port number is assigned to each end, like an address, to direct the flow of internet traffic.

Active7 years, 7 months ago

I used to think my understanding of the TCP and UDP protocols, although limited, is correct. Although recently, when I realized that peers sharing a common torrent can connect to one another through a TCP or UDP protocols without the actual need for port forwarding, I got confused. How does a router know which machine in the local network to forward packets to? Any help in clearing that up would be appreciated. The torrent protocol diagrams and articles on the Internet are greatly simplified, and hence do not contain any information that would help.

Neob91Neob91

2 Answers

The router (running NAT) tracks all outgoing packets and then allows incoming packets which are responses to those outgoing packets.

So if you make an outgoing TCP connection to google.com:80 then it will allow packets back in (in response) from google.com:80. If two internal hosts make a connection to the same port it can differentiate them because the local port is different, for example:

1) Host A makes a connection to Google and the router uses its own local port 10001 for the TCP connection

Udp

2) Host B makes a similar connection and the router uses its own local port 10002 for the TCP connection

If a packet comes in from google.com:80 and its addressed for the port 10001 on the router's WAN IP then the router knows to send it to Host A. If its addressed for port 10002 the router knows to send it to Host B.

If you have two peer to peer hosts behind routers (two NATs) then there is no way to establish the connection except that if there is something to transfer information about each others IPs (i.e. a server they can both use to exchange information) they can try to guess what port the router will choose as a local port and then start sending each other data on that port, to the routers WAN IP. Because both routers see data going OUT they then set up a rule to allow data IN. If the ports are guessed correctly then the packets from each side can get through because both routers have a rule set up. This is called UDP/TCP Hole Punching.

I believe Skype is an example of a app which uses UDP and does hole punching.

AntonyMAntonyM

Strictly speaking, since you haven't qualified your term router with 'NAT', then the answer is that the router uses ARP to determine the MAC address of the target host and then sends and ethernet frame with that MAC address as the target address.

But I think that was not what you meant.

You mean how does a NATting router know where to forward inbound packets?

The answer is that the router maintains a list of active 'connections' to enable it to be able to do address translation. It uses the outside port number to map to an inside host address and port number. In the case of TCP, the concept of a 'connection' is simply whether there is a TCP connection (though usually with a timeout to stop leakage). In the case of UDP it's harder because there is no UDP connection per se, so it is generally a case of tracking it by timeout alone.

user1167858

Not the answer you're looking for? Browse other questions tagged tcpudpforwarding or ask your own question.

You’ve probably seen references to TCP and UDP when setting up port-forwarding on a router or when configuring firewall software. These two protocols are used for different types of data.

TCP/IP is a suite of protocols used by devices to communicate over the Internet and most local networks. It is named after two of it’s original protocols—the Transmission Control Protocol (TCP) and the Internet Protocol (IP). TCP provides apps a way to deliver (and receive) an ordered and error-checked stream of information packets over the network. The User Datagram Protocol (UDP) is used by apps to deliver a faster stream of information by doing away with error-checking. When configuring some network hardware or software, you may need to know the difference.

What They Have In Common

RELATED:How to Find Your Private and Public IP Addresses

Both TCP and UDP are protocols used for sending bits of data—known as packets—over the Internet. Both protocols build on top of the IP protocol. In other words, whether you’re sending a packet via TCP or UDP, that packet is sent to an IP address. These packets are treated similarly, as they’re forwarded from your computer to intermediary routers and on to the destination.

TCP and UDP aren’t the only protocols that work on top of IP. However, they are the most widely used.

How TCP Works

TCP is the most commonly used protocol on the Internet.

When you request a web page in your browser, your computer sends TCP packets to the web server’s address, asking it to send the web page back to you. The web server responds by sending a stream of TCP packets, which your web browser stitches together to form the web page. When you click a link, sign in, post a comment, or do anything else, your web browser sends TCP packets to the server and the server sends TCP packets back.

TCP is all about reliability—packets sent with TCP are tracked so no data is lost or corrupted in transit. This is why file downloads don’t become corrupted even if there are network hiccups. Of course, if the recipient is completely offline, your computer will give up and you’ll see an error message saying it can’t communicate with the remote host.

TCP achieves this in two ways. First, it orders packets by numbering them. Second, it error-checks by having the recipient send a response back to the sender saying that it has received the message. If the sender doesn’t get a correct response, it can resend the packets to ensure the recipient receives them correctly.

RELATED:Understanding Process Explorer

Process Explorer and other system utilities can show the type of connections a process makes—here we can see the Chrome browser with open TCP connections to a variety of web servers.

How UDP Works

RELATED:How Latency Can Make Even Fast Internet Connections Feel Slow

The UDP protocol works similarly to TCP, but it throws out all the error-checking stuff. All the back-and-forth communication introduce latency, slowing things down.

When an app uses UDP, packets are just sent to the recipient. The sender doesn’t wait to make sure the recipient received the packet—it just continues sending the next packets. If the recipient misses a few UDP packets here and there, they are just lost—the sender won’t resend them. Losing all this overhead means the devices can communicate more quickly.

UDP is used when speed is desirable and error correction isn’t necessary. For example, UDP is frequently used for live broadcasts and online games.

For example, let’s say you’re watching a live video stream, which are often broadcast using UDP instead of TCP. The server just sends a constant stream of UDP packets to computers watching. If you lose your connection for a few seconds, the video may freeze or get jumpy for a moment and then skip to the current bit of the broadcast. If you experience minor packet-loss, the video or audio may be distorted for a moment as the video continues to play without the missing data.

This works similarly in online games. If you miss some UDP packets, player characters may appear to teleport across the map as you receive the newer UDP packets. There’s no point in requesting the old packets if you missed them, as the game is continuing without you. All that matters is what’s happening right now on the game server—not what happened a few seconds ago. Ditching TCP’s error correction helps speed up the game connection and reduce latency.

So What?

RELATED:How to Use Wireshark to Capture, Filter and Inspect Packets

Udp Or Tcp

Whether an application uses TCP or UDP is up to its developer, and the choice depends on what an application needs. Most apps need the error-correction and robustness of TCP, but some applications need the speed and reduced overhead of UDP. If you fire a network analysis tool like Wireshark, you can see the different types of packets travelling back and forth.

Unless you’re a network administrator or software developer, this shouldn’t doesn’t affect you too much. If you’re configuring your router or firewall software and you’re not sure whether an application uses TCP or UDP, you can generally select the “Both” option to have your router or firewall apply the same rule to both TCP and UDP traffic.

READ NEXT
  • › How to Easily Recycle the Old Electronics You Can’t Sell
  • › How to Check if Your Chromecast Is Still Getting Updates
  • › How to Play Adobe Flash SWF Files Outside Your Web Browser
  • › Command Lines: Why Do People Still Bother With Them?
  • › What to Do When Your Mac Won’t Shut Down