Re: [Haskell-cafe] How to return a network connection to C

2013-02-28 Thread Niklas Hambüchen
What data type are you dealing with exactly? If you have a socket, I guess you can just use it from C (via FFI). PS: By Network.Connection, do you mean http://hackage.haskell.org/package/network-connection-0.1.1 ? Seems deprecated. On 28/02/13 06:14, C K Kashyap wrote: Hi, I am using

Re: [Haskell-cafe] How to return a network connection to C

2013-02-28 Thread C K Kashyap
I am using http://hackage.haskell.org/package/connection. So I create network connection in Haskell getConnection :: IO Connection I'd like this connection to be returned to C so that subsequent calls from C can send in the connection handle. Regards, Kashyap On Thu, Feb 28, 2013 at 9:04 PM,

Re: [Haskell-cafe] How to return a network connection to C

2013-02-28 Thread Krzysztof Skrzętnicki
If I understand you correctly you need a StablePtr to your Connection value. Please see: http://www.haskell.org/ghc/docs/latest/html/libraries/base-4.6.0.1/Foreign-StablePtr.html Best regards, Krzysztof Skrzętnicki On Thu, Feb 28, 2013 at 6:31 PM, C K Kashyap ckkash...@gmail.com wrote: I am

Re: [Haskell-cafe] How to return a network connection to C

2013-02-28 Thread Donn Cave
Quoth C K Kashyap ckkash...@gmail.com, I am using http://hackage.haskell.org/package/connection. So I create network connection in Haskell getConnection :: IO Connection I'd like this connection to be returned to C so that subsequent calls from C can send in the connection handle.

Re: [Haskell-cafe] How to return a network connection to C

2013-02-28 Thread C K Kashyap
Okay, for now I have figured out a working solution to the original problem I was facing . I just forkIO another IO action that does the actual network work and in addition, it opens a server socket and waits for commands. The calls from C reach Haskell, from where a connection is made to

Re: [Haskell-cafe] How to return a network connection to C

2013-02-28 Thread Donn Cave
Quoth C K Kashyap ckkash...@gmail.com, Hey Donn ... when you say, implement the IO in C, you also imply implementing the SSL stuff too right? Yes, if you need encrypted I/O from C. Donn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] How to return a network connection to C

2013-02-27 Thread C K Kashyap
Hi, I am using Network.Connection to connect to gmail in my Haskell module - that's compiled to DLL and invoked from C. I need a mechanism to return the connection handle to C so that it can pass it in the subsequent calls. How can I achieve this? Regards, Kashyap