Haskell connectTo problem
Hello, I try to connect to host:
connectTo "httpbin.org" (PortNumber 80) {handle: <socket: 8>}
It's ok. But if i try to connect:
connectTo "httpbin.org/ip" (PortNumber 80) *** Exception: getAddrInfo: does not exist (Name or service not known)
Why i got this error? Thank you.
Not knowing anything about the package or the function, my guess is connectTo wants a domain name, not a URL, because it proceeds to do a DNS lookup on exactly that. You probably want a different function. There's something called simpleHTTP or thereabouts. -- Kim-Ee On Sat, Jan 5, 2013 at 8:25 PM, Alexander 0xAX < anotherworldofworld@gmail.com> wrote:
Hello,
I try to connect to host:
connectTo "httpbin.org" (PortNumber 80) {handle: <socket: 8>}
It's ok. But if i try to connect:
connectTo "httpbin.org/ip" (PortNumber 80) *** Exception: getAddrInfo: does not exist (Name or service not known)
Why i got this error?
Thank you.
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
On Sat, Jan 5, 2013 at 8:25 AM, Alexander 0xAX < anotherworldofworld@gmail.com> wrote:
connectTo "httpbin.org/ip" (PortNumber 80) *** Exception: getAddrInfo: does not exist (Name or service not known)
connectTo is not a web browser, but low level TCP/IP; it wants a hostname, and only a hostname. If you wanted to write a web browser or HTTP fetch utility, you would connectTo the host on port 80 and then conduct an HTTP exchange to GET /ip. There are higher level libraries if you want to use HTTP without writing it yourself. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
participants (3)
-
Alexander 0xAX -
Brandon Allbery -
Kim-Ee Yeoh