using TCP & UDP together

Started by
0 comments, last by hplus0603 18 years, 4 months ago
Hi, I remember reading in a old thread on this forum about using TCP and UDP concurently. There where some potential problems you could run in to when using both a TCP socket for reliable in order messages and UDP for unreliable updates in the same game. Does anyone know more about this? And if it doesn't cause any problems, why would anyone bother using a reliable protocol wrapped around UDP like Enet?
Advertisement
On a modem or another narrow channel (like the uplink of a cable or DSL connection), large TCP fragments may cause excessive jitter for UDP packets.

Also, on the server side, you need one TCP socket per connected client, whereas you only need a single socket for all UDP communications. If you want to host a lot of players, you'll start using more and more CPU for managing the sockets in the networking stack -- you may want to use that CPU for something else.

TCP does not, in general, work with NAT punch-through set-ups; i e, your server must be on a publicly visible IP address.

Those are the biggies. If neither is a problem for you, then there's no reason you can't use TCP and UDP at the same time.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement