0

SDLNet_ResolveHost always return 0 no matter if there is any host on that IP and port. According to the documentation it should return -1 when an error occurs.

How can a non existing host be detected?

user11914177
  • 885
  • 11
  • 33
  • 1
    So it's returning `0` for something blatantly non-existent like `"invalid"`? Or are you using an IP string like `"4.4.4.4"`? I'd expect the IP strings to always "resolve", since there's nothing really to do other than check that the IP isn't malformed & populate `address.host`. – genpfault Nov 12 '19 at 16:22
  • @genpfault It return zero on a IP that could be real, but doesn't contain a host answering. So I have to rename my question, I want to know if the host exists and is ready for answers. – user11914177 Nov 12 '19 at 17:04
  • 1
    Well, you have to actually try a `SDLNet_TCP_Open()` to figure that out, `SDLNet_ResolveHost()` only resolves stuff. – genpfault Nov 12 '19 at 17:42

1 Answers1

0

Ok, so I found the solution. SDLNet_TCP_Open will return NULL when an error occurs.

user11914177
  • 885
  • 11
  • 33