- Home /
How do I identify if the packet arrived by UDP or TCP protocol
I have virtual worlds which can be controlled by user through TCP and UDP (remotely via iPhone / Android phones). How do I distinguish if the data arrived (from client's point of view) via TCP / UDP protocol?
Answer by Benproductions1 · Sep 10, 2013 at 01:35 AM
Hello,
I'm assuming you are handeling the networking yourself, so you have full access to the conections themselves, however you are not handeling packets themselves. If you are handeling packets yourself, it would be quite usefull to know how you are doing your networking.
It's relatively easy:
TCP uses handshaking and therefore sessions. To see if a packet is UDP or TCP, it has to be part of a TCP session. If a packet is part of a session, it must be TCP.
If the packet is UDP, it doesn't have any session info. It doesn't have to contain who sent it. It's simply a single message.
I don't know much about each protocol when it comes to packet setup, but a google search should give you more than enough information on that.
Hope this helps,
Benproductions1
Your answer
Follow this Question
Related Questions
Networking source for new networking example 0 Answers
Unity sockets 1 Answer
UDP/TCP Simple example on how to send a receive messages from two Unity builds 2 Answers
How to receive streaming data over a UDP connection? 1 Answer
How can I get deep info on configuration of Unity networking? 0 Answers