On Tue, 12 Nov 2013 00:19:39 GMT, Stephan Dilly wrote:
On Mon, 11 Nov 2013 21:26:24 +0100, Sönke Ludwig wrote:
Am 11.11.2013 21:24, schrieb Dicebot:
On Mon, 11 Nov 2013 19:26:00 GMT, Stephan Dilly wrote:
I just know that I was able to query my ip on a nodejs server using dns.resolve(OS.hostname()) and it was the public IP as seen by external services for every listening interface.
This should be equivalent:
import std.socket : Socket; import vibe.core.net : resolvehost; auto ip = resolveHost(Socket.hostName);
Socket.hostName
is nicer of course.This crashes on win32 with this:
object.Exception@C:\Users\Stephan\AppData\Roaming\dub\packages\vibe-d-master\source\vibe\core\drivers\libevent2.d(201): Invalid IP address string: <PC-Name>
Did you set the no_dns
parameter of resolveHost
to true
? It needs to be false
in order to resolve host names. But there is an additional issue - libevent doesn't parse the local "hosts" file, so if the host name is not registered in DNS, it will still fail.
As an alternative, I'd recommend to use "subConfigurations": {"vibe.d": "win32"}
to use the native Win32 driver instead of libevent.