Surely in TCP I can just save instance of TCPClient when a user connects thry my listener…
But how does it work for udp?
Say I have a pong game I tell the server to wait for 2 different clients sending a ‘Joined’
Packet before sending back a ‘Game Start’ packet to init game variables.
How do I tell the clients apart ?
And not same clients sending few ‘Joined’ packets… etc.
Hi @dudinirgad the UDP transport protocol doesn’t establishes a connection as TCP does, so you don’t have the confirmation packages or disconnection events.
UDP is useful when you have to transfer some massive data locally, as video frames, so if some of them are lost it doesn’t matters. Also UDP clients cane start or stop listening at any time.
If you need a reliable connection, keep using TCP, or you will have to implement some confirmation and timeout procedures.
Chose the appropriate protocol depending on your needs.
Best regards.