I have a problem with the tcp and udp synchronization.

On the server it accepted the tcp connection with the: SDLNet_TCP_Accept(); But now I need to know how to get the remote address of the udp_socket of the client to use it to send upd packets.

I already tried to use(on the server) the function SDLNet_TCP_GetPeerAddress(); to get it. The ip was right, but the port was't. I tried the SDLNet_UDP_GetPeerAddress(); (on the client) but it just gives the local address.

What can I do now?

closed as unclear what you're asking by gnat, Bart van Ingen Schenau, user22815, enderland, GlenH7 Feb 25 '16 at 18:15

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


Your TCP connection "doesn't know" anything about any UDP connections. If you established TCP connection and want to send additional UDP packets, you will have to determine the the correct port yourself.

You can have the client send the port number via your existing TCP connection. This won't work if client is behind NAT though.

The best solution would be to have the client initiate both TCP and UDP connections. Or, try limiting your communication to just UDP or just TCP.

Not the answer you're looking for? Browse other questions tagged or ask your own question.