Fwd: [Haskell-cafe] Weird socket problem on Mac OS X

Arnaud Bailly arnaud.oqube at gmail.com
Fri Jun 4 05:59:55 EDT 2010


---------- Forwarded message ----------
From: Arnaud Bailly <arnaud.oqube at gmail.com>
Date: Fri, Jun 4, 2010 at 11:59 AM
Subject: Re: [Haskell-cafe] Weird socket problem on Mac OS X
To: Antoine Latter <aslatter at gmail.com>


Hello,
I managed to solve the problem using Network.Socket instead of
Network. Is this a bug or a feature ?

Arnaud

On Fri, Jun 4, 2010 at 7:11 AM, Arnaud Bailly <arnaud.oqube at gmail.com> wrote:
> Yes, I have also seen the other post on the same topic, but it seemed
> to refer to the PortNumber in Network.Socket with a PortNum
> constructor I think, not the one in Network (but I am probably
> misleading myself as one is a reexportation of the other...).
> But then I got.
>
> Slim\SlimClientIO.hs:26:51:
>    No instance for (Num PortID)
>      arising from a use of `fromInteger'
>                   at Slim\SlimClientIO.hs:26:51-61
>    Possible fix: add an instance declaration for (Num PortID)
>    In the first argument of `($)', namely `fromInteger'
>    In the expression: fromInteger $ slimport $ slimConfig st
>    In the definition of `port':
>        port = fromInteger $ slimport $ slimConfig st
>
> :-(
> Thanks
>
> Arnaud
>
> On Fri, Jun 4, 2010 at 1:46 AM, Antoine Latter <aslatter at gmail.com> wrote:
>> Hi Arnaud,
>>
>> One thing you might want to try is to stop using the PortNumber data
>> constructor, and instead rely on 'fromInteger' to do the right thing.
>>
>> The data constructor assumes that it's argument is in network byte order,
>> which won't always be the case.
>>
>> It's not obvious that the constructor should be avoided - this is the second
>> time today I've seen this!
>>
>> Take care,
>> Antoine
>>
>> On Jun 3, 2010 5:13 PM, "Arnaud Bailly" <arnaud.oqube at gmail.com> wrote:
>>
>> Hello,
>> I have the following code which works ok on Linux and Windows XP, but
>> fails on Mac OS X with error message:
>>
>> Connect: does not exist (connection refused)
>>
>> The server:
>>
>>    doStartstate = do pr <- liftIO $ runProcess  ...
>>                                    liftIO $ threadDelay 500000
>>                                   st <- get
>>                                   put st { slimHandle = Just pr }
>>
>>
>> The client:
>>
>>    fetchAnswers st msgs = liftIO $! do let port = PortNumber $
>> fromInteger $ port $ config st
>>                                        cnx <- connectTo "localhost" port
>>
>> Help most welcome, thanks
>>
>> Arnaud
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>


More information about the Haskell-Cafe mailing list