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

Author Topic: [SFML2] Network Help  (Read 4975 times)

0 Members and 1 Guest are viewing this topic.

Valeour

  • Newbie
  • *
  • Posts: 19
    • View Profile
[SFML2] Network Help
« on: September 13, 2011, 12:53:29 pm »
Okay, so I used the networking tutorial for 1.6, and then realised the changes, now here's a few problems I have;

Instead of (!IPAddress.IsValid()), what can I use to check if the IPAddress is valid? Seeing as IsValid() as been removed.

Also, I constantly see "Failed to bind Port ####". (# being the port number...)

The port is forwarded on my router, so what else is the problem? I've let it through my firewall too.

(The code I'm using is literally the UDP Socket example with a few changes to fit SFML2.)
Check out my blog; Technical Daze

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[SFML2] Network Help
« Reply #1 on: September 13, 2011, 01:03:20 pm »
Quote
Instead of (!IPAddress.IsValid()), what can I use to check if the IPAddress is valid? Seeing as IsValid() as been removed.

Code: [Select]
if (address == sf::IpAddress::None)
{
    // invalid address
}


Quote
Also, I constantly see "Failed to bind Port ####". (# being the port number...)

The port is forwarded on my router, so what else is the problem? I've let it through my firewall too.

(The code I'm using is literally the UDP Socket example with a few changes to fit SFML2.)

I have no idea, could be a lot of things. But why don't you try the Sockets example of SFML 2 directly? It has UDP, and it works ;)
Laurent Gomila - SFML developer

Valeour

  • Newbie
  • *
  • Posts: 19
    • View Profile
[SFML2] Network Help
« Reply #2 on: September 13, 2011, 01:41:46 pm »
Quote
Sockets example of SFML 2

Er... Hate to be a pain, but where is that...? I've looked for SFML2 examples, but can't find any on networking, or do you mean use the 1.6 example?



And thank you for the sf::IpAddress::None. I did wonder if it was that, but apparently I used it incorrectly!
((!Var.None()). No wonder it didn't work. Haha.)
Check out my blog; Technical Daze

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[SFML2] Network Help
« Reply #3 on: September 13, 2011, 01:44:47 pm »
Quote
Er... Hate to be a pain, but where is that...?

The sockets example is... under examples/sockets ;)

EDIT: just in case https://github.com/SFML/SFML/tree/master/examples/sockets
Laurent Gomila - SFML developer

Valeour

  • Newbie
  • *
  • Posts: 19
    • View Profile
[SFML2] Network Help
« Reply #4 on: September 13, 2011, 01:54:10 pm »
OOOOH.

Sorry, I fail badly at github related stuff. You should see my SFML2 update batch file. Cringe worthy.

Anyway, thank you very kindly Laurent. Excellent 'service' as ever!
Check out my blog; Technical Daze

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[SFML2] Network Help
« Reply #5 on: September 13, 2011, 02:07:18 pm »
Quote
Sorry, I fail badly at github related stuff. You should see my SFML2 update batch file. Cringe worthy.

I hope that you're not doing something over-complicated here. All that is required to update SFML 2 is "git pull" and then "make" (or click on "compile" if you're inside an IDE).

And what scares me is that, based on what you write, you didn't seem to have the "examples" directory in your local working copy of SFML -- I can't imagine how this could happen ;)
Laurent Gomila - SFML developer

Valeour

  • Newbie
  • *
  • Posts: 19
    • View Profile
[SFML2] Network Help
« Reply #6 on: September 13, 2011, 02:13:37 pm »
Oh wow, my ignorance is shooting through the roof today.
If you can believe me, I'm not always like this.

Yes, I have an examples folder.
Whenever I tried git pull, I always got an error about local branch, can't quite remember.

Don't worry, my batch file is safe and what not, it just takes a stupidly long way round.

(Delete SFML folder, redownload new sfml, recompile, done.)

Edit:
Example worked, port bound and what not. Thank you very much!
Check out my blog; Technical Daze