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

Author Topic: sf::IpAddress doesn't accept string  (Read 3323 times)

0 Members and 1 Guest are viewing this topic.

slinky55

  • Newbie
  • *
  • Posts: 2
    • View Profile
sf::IpAddress doesn't accept string
« on: September 08, 2022, 07:07:45 pm »
I was reading documentation on the networking module, and the example code shows that the sf::IpAddress constructor may take a string as it's argument, however when writing my own code, this doesn't seem to be the case.  I took a look at the header file, and there doesn't seem to be this constructor.  Is this a mistake in the documentation, or on my part?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: sf::IpAddress doesn't accept string
« Reply #1 on: September 08, 2022, 09:24:32 pm »
Not sure what you're talking about, because the IpAddress class certainly has a constructor taking a string: https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1IpAddress.php#a656b7445ab04cabaa7398685bc09c3f7

If you use the latest in development SFML version, then the API has changed indeed to sf::IpAddress::resolve("127.0.0.1");
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

slinky55

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: sf::IpAddress doesn't accept string
« Reply #2 on: September 13, 2022, 03:19:32 am »
If i'm using SFML as a submodule would this be the issue?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: sf::IpAddress doesn't accept string
« Reply #3 on: September 13, 2022, 08:00:53 am »
Not sure what "it" means in that context.

You can use SFML as submodule.
If you fetch the master branch, then you get the latest version, which has a slightly different API, as described.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything