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

Author Topic: GetLocalAddress doesnt seem correct  (Read 3473 times)

0 Members and 1 Guest are viewing this topic.

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
GetLocalAddress doesnt seem correct
« on: September 03, 2011, 12:11:02 am »
When i do this:

sf::IpAddress::GetLocalAddress().ToString();

I get 127.0.0.1, i was expecting my LAN address 192.168.10.2.

Any other way to get it?

Thanks

Haikarainen

  • Guest
Re: GetLocalAddress doesnt seem correct
« Reply #1 on: September 03, 2011, 07:08:14 am »
Quote from: "DevilWithin"
When i do this:

sf::IpAddress::GetLocalAddress().ToString();

I get 127.0.0.1, i was expecting my LAN address 192.168.10.2.

Any other way to get it?

Thanks


Thats weird, you should think IpAdress::LocalHost would be 127.0.0.1.. SFML Network doesn't seem to be able to list assigned ipadresses either, maybe we should post this feat on the bugtracker :p

for now i found this: http://www.codeguru.com/forum/showthread.php?t=233261

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
GetLocalAddress doesnt seem correct
« Reply #2 on: September 03, 2011, 09:53:30 am »
Handling multiple network interfaces in SFML is planned for the future.

I don't know why you get localhost instead of your local network address, but maybe it's related to this issue:
https://github.com/SFML/SFML/issues/47

What's your OS?
Laurent Gomila - SFML developer

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
GetLocalAddress doesnt seem correct
« Reply #3 on: September 03, 2011, 01:22:57 pm »
Windows 7 32bit !

I have a really simple ISP service through ADSL. I own a DLink wireless router, to which the laptops in my house connect. My computer connects directly via RJ-45 cable.

My computer and the laptops work fine as a LAN, even allowing file sharing etc.

Thanks

Haikarainen

  • Guest
GetLocalAddress doesnt seem correct
« Reply #4 on: September 04, 2011, 09:12:29 am »
Hm, I tried this out and found out I also get 127.0.0.1 ! :S

Code: [Select]
std::cout << "Local address: " << sf::IpAddress::GetLocalAddress().ToString().c_str() << "\n";
std::cout << "Public address: " << sf::IpAddress::GetPublicAddress().ToString().c_str() << "\n";


Gives;
Quote
Local address: 127.0.0.1
Public address: 81.170.129.***


OS: Windows XPSP3 w/ latest updates
SFML: old unstable of 2.0
Network: RJ45 -> Router(D-Link DIR 615) -> Fibreconverter

Local addresses;
192.168.0.100 - Network
192.168.56.1 - Virtualbox Hostonly

Doesnt matter if i disable virtualbox adapter

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
GetLocalAddress doesnt seem correct
« Reply #5 on: September 04, 2011, 09:39:52 am »
I can reproduce the bug too. It seems that is was broken with some revision a few months ago; so at least I should be able to fix it easily :)

Thanks for your feedback.
Laurent Gomila - SFML developer

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
GetLocalAddress doesnt seem correct
« Reply #6 on: September 04, 2011, 01:59:55 pm »
When its fixed please warn us Laurent, and thanks a lot for all the support. You re the man :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
GetLocalAddress doesnt seem correct
« Reply #7 on: September 04, 2011, 02:46:08 pm »
It's fixed.
Laurent Gomila - SFML developer