Can TCP be implemented via UDP?

2019-03-08 19:47发布

I had a strange idea. I heard of software which from my understanding uses UDP to transfer files decreasing the overhead found in TCP packets.

If my app requires TCP and my LAN has software setup to communicate with another datacenter on the other side of the coast with software setup on their end. Would it be possible to send the actual data via UDP but than simulating TCP on both ends?

I vaguely remember something about 7 layers but i am unsure if protocol was one of the layers and i am unsure if TCP is impossible to simulate/implement perfectly when using UDP across the network. Does anyone have any ideas or information about such projects?

9条回答
相关推荐>>
2楼-- · 2019-03-08 20:08

You can simulate something like a connection over UDP, and you as well can add reliability checks and ordering and retransmission and so on. - but then, it still isn't TCP, it just acts the way.

Of course, one of the ends can be a kind of "hub" or "proxy" which does an adaption. Then you don't have a 2-end solution, but in fact a 4 end solution - one pair with "real" TCP and the other with the "self-knitted" "TCP" - which you put together with an appropriately crafted program.

查看更多
小情绪 Triste *
3楼-- · 2019-03-08 20:09

Hmm, I believe so. You'd need to use a proxy at both ends, but it should be possible.

The biggest problem you are going to run into is that UDP is designed with the idea that you don't care if some of the packets don't ever make it to the other end.

Here's a link with some more info:

http://www.cyberciti.biz/faq/key-differences-between-tcp-and-udp-protocols/

IMHO, it's not a good idea to transmit files via UDP.

查看更多
Fickle 薄情
4楼-- · 2019-03-08 20:11

TCP's problems are in its algorithms, not its headers.

You certainly could implement the TCP algorithms on top of UDP. That would effectively be the same as tunneling TCP datagrams inside of UDP datagrams. But all this accomplishes is to add a few more bytes of overhead to each packet, and require another endpoint to unwrap the packets.

UDP itself is just thin shim on top of IP: its a convenient way to access IP packet switched networking without having to dive into kernels or receive special handling from routers. The main reason to implement reliable transport on top of UDP is to get away from TCP algorithms in favor of something more efficient. FileCatalyst was mentioned above as one company which does this, and my own company Data Expedition, Inc. does so as well.

So you could implement TCP algorithms on top of UDP, but you wouldn't want to.

查看更多
Lonely孤独者°
5楼-- · 2019-03-08 20:13

Yes, you can develop a protocol on UDP that simulates TCP. However, if you simulated TCP fully, it would technically have more overhead. Because TCP is implement as the packet and your simulated TCP is implemented in the body of the packet.

If you only need one or two features of TCP (such as basic ordering), then implementing it in UDP is useful.

Halo uses 2-3 (IIRC) UDP protocols that simulate different features of TCP, then full fledged TCP for initializing game-states. I Shot You First Networking, GDC publication

For example, in one case, they send 3 duplicate UDP packets to overcome packet loss.

If you control the software on both ends, and it is cost-effective to build your own protocol, then UDP can be versatile.

查看更多
做自己的国王
6楼-- · 2019-03-08 20:15

PseudoTCP is a protocol which implements TCP algorithms on top of the UDP. It was introduced since the NAT traversal for TCP is much more complicated than UDP. But some P2P applications do need a reliable data transfer among nodes.

So far as I know, there are two PseudoTCP variations: Libjingle and Libnice.Libjingle is an open source library from google which was initially for gtalk. You could take a look at file sharing example from libjingle: https://developers.google.com/talk/libjingle/file_share. Recently, Chrome desktop also use PseudoTCP implementation from libjingle for reliable connections.

查看更多
倾城 Initia
7楼-- · 2019-03-08 20:18

One way to do it now on Linux-3.18+ is to use Foo over UDP (FOU) which implements Generic UDP Encapsulation (GUE). Here's a good introduction to FOU, and the man page for ip-fou.

Or if you want an [open source] UDP based file transfer system there are things like UDT, UFTP, Tsunami-UDP, and even Google's QUIC.

查看更多
登录 后发表回答