Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

UDP or TCP?


Akrivus
 Share

Recommended Posts

I thought of making my own MMORPG engine and this was a question that came up to me a lot, and that was to use either UDP or TCP.

My initial reasoning was to use TCP because Eclipse uses it, but then I discovered that massive overhead that TCP has an the Nagle's algorithm, and UDP has some issues with firewall, so I've read. I decided to make this thread just for the sake of seeing some other, more professional people to talk about it.
Link to comment
Share on other sites

I am sure there is plenty of articles around the internet you can find. Why not both?

I personally used UDP for player movements and stuff I sent a lot and didnt care about losing. Then TCP for important chat messages / login info etc. I never did a ton of research on the subject it just seemed to make sense to me.
Link to comment
Share on other sites

TCP is good for login, UDP is good for data that you can take a chance of it being lost like movement. You need to know what data is important and what data can be lost without causing problems. If the client is predicting, you almost always want to use UDP.
Link to comment
Share on other sites

> TCP is good for login, UDP is good for data that you can take a chance of it being lost like movement. You need to know what data is important and what data can be lost without causing problems. If the client is predicting, you almost always want to use UDP.

I see, so would this be where the advantage of multi-core comes in? So you could have a login server on one core and then the game server on the other?
Link to comment
Share on other sites

> I see, so would this be where the advantage of multi-core comes in? So you could have a login server on one core and then the game server on the other?

TCP and UDP are just the way packets are sent. The speed or cores does not matter. UDP sends a packet without verifying that it was successfully delivered, and TCP is where the client sends a packet back to the server indicating that it received it. UDP is faster and more lean than TCP, but TCP is still used for important packets.
Link to comment
Share on other sites

Your better off with tcp. Theres alot of data that you wanna make sure is sent and received on both sides and trying to work around failsafes and ensuring the data is received udp can be a pain and more work in the end. As well with udp your relying location of servers rather than direct connection which can be a big problem if people arent close.

ALSO theres the security holes that come with UDP. Either you rely on a player being honest in sending their index to identify them, or your relying on them sending an ID assigned by the server which can be kinda random, or the IP of the user. In any of these cases that arent IP, you are risking someone else catching a players id and spoofing them which can result in hacked player accounts… or you are basicly having the client trust their ip wont be stolen or attacked by another user that can capture the floating packet.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...