SFML community forums

Help => Network => Topic started by: roccio on August 21, 2018, 10:58:20 am

Title: UDP multiple ports
Post by: roccio on August 21, 2018, 10:58:20 am
Hello, I would like to know if it is possible to have two udp sockets receiving on two different port at the same ipaddress.

Thanks
Title: Re: UDP multiple ports
Post by: eXpl0it3r on August 21, 2018, 12:18:04 pm
Yes, that's possible. :)
Title: Re: UDP multiple ports
Post by: roccio on August 21, 2018, 02:31:32 pm
Ok, thank you.

Now I have another question for you masters ;)

I would like to send a quite big image over the net as fast as possible (it must be runtime). I have it compressed so it's like 120K, what's the best method?

It's ok to use UDP (datagram limit) or better go to TCP?
Title: Re: UDP multiple ports
Post by: dabbertorres on August 21, 2018, 06:35:53 pm
I recommend reading about the differences between both protocols.

But, in general, a (simplified) rule of thumb:

If you need perfect replication of the data (ie: a file), you use TCP.
If not, you can use UDP.
Title: Re: UDP multiple ports
Post by: roccio on August 22, 2018, 06:42:13 pm
Is it possible to mix UDP and TCP sockets?

Can I have one UDP socket and another TCP running at the same time?
Title: Re: UDP multiple ports
Post by: dabbertorres on August 22, 2018, 07:26:07 pm
Of course, and is relatively common. For example, DNS uses both UDP and TCP (port 53).