Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: UDP multiple ports  (Read 6492 times)

0 Members and 1 Guest are viewing this topic.

roccio

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
    • Email
UDP multiple ports
« 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

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: UDP multiple ports
« Reply #1 on: August 21, 2018, 12:18:04 pm »
Yes, that's possible. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

roccio

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
    • Email
Re: UDP multiple ports
« Reply #2 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?

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: UDP multiple ports
« Reply #3 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.

roccio

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
    • Email
Re: UDP multiple ports
« Reply #4 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?

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: UDP multiple ports
« Reply #5 on: August 22, 2018, 07:26:07 pm »
Of course, and is relatively common. For example, DNS uses both UDP and TCP (port 53).