Client Side - Receive Packets without Sending

Hello guys,

I am currently working on a multiplayer 2d top down racer and got a question about networking.

At the moment when a client wants the new postion of the players it sends an udp packet and with the packets inetaddress and port the server can send the position to the client.
Now i thought this is really inconvenient so tried saving the port and inetaddress of each player in a HashMap and start a new Thread on the server where i send the movement updates to every client whos in the map every 30 ms or so … unfortunately in this way the clients did not receive the packets.

So my question is: How can my clients receive udp packets from the server without sending an udp-packet before receiving?

Hope you guys understand my problem and i am looking forward to your answers!!! :wink:

If the clients are firewalled like most home PCs are, there’s almost no way you’re going to get a udp packet through without them pinging you with one first. Are you sure you want to be using UDP?

Well,i always read that udp is faster and should be used in fast paced games.

When i use tcp i can always send data from server to client without sending data from client to server, because i can write to the inputstream of the client,right?

If Tcp is really acceptable speedwise i would have no problem using it, but i dont know if it is :smiley:

It might be a simplified view but my stance is like this:
If You don’t know why to use UDP, use TCP. Once You have enough experience or You are hitting a problem, You will know which one is better for You and why.