UDP programming

I am a little bit lost concerning UDP (not a lot documenting here, in fact).

My context is this one : I have a server, where different people are connecting for a multiplayer game.
All was in TCP for convenience, but for some network issues, I want to swap to UDP for part of my communication (movement, rotation, …).

Using TCP, it was something quiet simple. I listen to a port, and wait for connection.
When a player connects, I store the connection in the user object.
Next, I am able to send to him all information I wish, because I maintain a connection with him.

I maybe misunderstood, but UDP seems connectionless.
Other constraints for my test, server and client are on same pc.


self.udpSocket = self.cManager.openUDPConnection(port_address)


self.serverAddr = NetAddress() 
self.serverAddr.setHost(ip_address, 9097) 

The both cannot bind the same port on connection (otherwise I have an error message on client : cannot bind 9098).
So I suppose that netadress is a trick to redefine the port to listen or to write?

Other question, when my listener (server side), receive a communication, can I store an connection object like for tcp?

if self.cListener.newConnectionAvailable():
rendezvous = PointerToConnection()
netAddress = NetAddress()
newConnection = PointerToConnection()

I am afraid of not…
And if I can have a persistent connection to all my clients, how can I broadcast to all my clients in UDP?

I am bit confuse…

So… i dug into an old project of mine that used only udp networking.i didn’t document anything so ill try and give you some answers.

In my example i have a connection class that holds information about each client.all it needs is a NetAddress() member and maybe some kind of id system.
Each time someone sends a packet i check if their i.p is in a dictionary if its not i add the i.p and an instance of the class to the dictionary.

The client connects to a different port than the server.

use the send method to send data to the address you want.

 self.cWriter.send("data","your opened udp socket","Netadress target")

packets of data have to opened in the same order they are created.

Yeah this is a pretty bad but its all i remember there might be one fact in there that helps you or it could be all wrong lol.