Network Exception

2005-10-14 Thread Arias

Hi,

I've a problem, I'm using this code on GHC compiler version 6.4.1:

--- BEGIN ---
module Main where
import System.IO
import Network

main = withSocketsDo $ do
handle - connectTo localhost ( PortNumber 8080 )
hSetBuffering handle LineBuffering
hClose handle
--- END ---

The problems is that it throws an exception at connectTo, the exception is:

getServiceEntry: does not exist (no such service entry)

The server and the port is correct, I have apache listening on port 8080 
and if I put http://localhost:8080/ on browser it loads a web page.


Do somebody knows what it happens and how to fix it? thanks.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Network Exception

2005-10-14 Thread Dinko Tenev
It looks odd to me, because the service is not particularly meaningful to the transport, and thus not a crucial piece of
information. Unless I am missing something, this could be a
bug in the Network module.

You may want to try the lower-level stuff from Network.Socket instead.

Cheers,
Dinko
On 10/14/05, Arias [EMAIL PROTECTED] wrote:

Hi,I've a problem, I'm using this code on GHC compiler version 6.4.1:--- BEGIN ---module Main whereimport System.IOimport Networkmain = withSocketsDo $ dohandle - connectTo localhost ( PortNumber 8080 )
hSetBuffering handle LineBufferinghClose handle--- END ---The problems is that it throws an exception at connectTo, the exception is:getServiceEntry: does not exist (no such service entry)

The server and the port is correct, I have apache listening on port 8080and if I put http://localhost:8080/ on browser it loads a web page.Do somebody knows what it happens and how to fix it? thanks.
___Glasgow-haskell-users mailing listGlasgow-haskell-users@haskell.org

http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Network Exception

2005-10-14 Thread Arias

Thanks for the reply.

I don't know if the problem is the same, but when I try to run this code:

main = withSocketsDo $ do
  host - getHostName
  putStrLn host

the getHostName throws this exception:

  getHostName: failed (Successful WSAStartup not yet performed 
(WSANOTINITIALISED))


:( I'm using Windows XP Professional

Sigbjorn Finne escribió:


Hi,

that error message is a bit confusing, to say the least:
getProtocolByName identifies itself as getServiceEntry
when failing. In this case, I'm quite sure, your snippet
fails because (getProtocolByName tcp) isn't successful.
I've no idea why your /etc/protocols doesn't contain an entry
for 'tcp'.

The error message in said function has now been fixed; thanks
for the report.

--sigbjorn

- Original Message - From: Arias [EMAIL PROTECTED]
To: glasgow-haskell-users@haskell.org
Sent: Friday, October 14, 2005 06:47
Subject: Network Exception



Hi,

I've a problem, I'm using this code on GHC compiler version 6.4.1:

--- BEGIN ---
module Main where
import System.IO
import Network

main = withSocketsDo $ do
handle - connectTo localhost ( PortNumber 8080 )
hSetBuffering handle LineBuffering
hClose handle
--- END ---

The problems is that it throws an exception at connectTo, the 
exception is:


getServiceEntry: does not exist (no such service entry)

The server and the port is correct, I have apache listening on port 
8080 and if I put http://localhost:8080/ on browser it loads a web page.


Do somebody knows what it happens and how to fix it? thanks.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users 







___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Network Exception

2005-10-14 Thread John Meacham
By chance are you statically linking the program?

if you statically link a program on linux (and some other systems), it
cannot look up hostnames, protocols, or passwd entries.

you can look up the protocol number in /etc/protocols and hardcode it
and use IP addresses rather than names and it should work fine. I had
to use a similar workaround in the statically linked ginsu.

John

-- 
John Meacham - ⑆repetae.net⑆john⑈ 
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users