Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Unable to resolve localhost:33333

Moderators: kris

Posted: 02/20/09 08:45:34

module test;

import tango.io.Stdout;
import tango.net.Uri;
import tango.net.http.HttpGet;
import tango.net.http.HttpHeaders;


void main() {
    Uri url = new Uri("http://localhost:33333");
    auto page = new HttpGet(url);
    auto content = cast(char[])page.read();
    Stdout(content);
}

tango.core.Exception.AddressException?: Unable to resolve localhost:33333

?

Sorry for my bad English, im German ;)

Author Message

Posted: 02/20/09 12:51:16

Don't worry about your english :)

Since you don't say, is there a web server serving pages on localhost:33333 ?

Posted: 02/20/09 13:31:53

Yes, there is a webserver but this is a ssh tunnel:

ssh myserver.de -L33333:mytargetserver:8000

behind mytargetserver:8000 there is a webserver


Sorry for my bad English, im German ;)

Posted: 02/20/09 13:52:46

Are you able to ping that address or open it with a web browser?

Posted: 02/20/09 13:55:41

Ah, sorry i forget. In Browser ist works fine, no problems. In Perl it works too ;)


Sorry for my bad English, im German ;)

Posted: 02/21/09 13:39:51

Does it work when you try to get "http://127.0.0.1:33333"? What operating system and what version of tango are you using?

Posted: 02/21/09 16:38:25

The error is coming from tango/net/Socket.d, line 1846, because it cannot resolve localhost as a host name. It is calling the gethostbyname C call, so either there is an error in that system call (unlikely), or the system call isn't able to resolve localhost for this particular process.

Some things to check:

  • make sure your environment is set up properly (I have seen cases on windows where resolving host names doesn't work if the environment isn't set up).
  • make sure you don't have any weird non-printing characters in your address string that are being passed to the system call.

-Steve

Posted: 02/23/09 11:45:58 -- Modified: 02/23/09 11:47:16 by
lulabad

elite01 wrote:

Does it work when you try to get "http://127.0.0.1:33333"? What operating system and what version of tango are you using?

this works well. but i dont understand this.

-> host localhost
localhost has address 127.0.0.1

I use Red Hat 5.2 x64

Ok, my SysAdmin? (on my right side) says localhost is not in /etc/hosts. Putting localhost into /etc/hosts solves the problem


Sorry for my bad English, im German ;)