Just one question

Simon Marlow simonmar@microsoft.com
Thu, 8 Mar 2001 09:26:57 -0800

Alba Marina Lopez Arguelles writes:
> - There's a function in the library Socket called connectTo 
> and I would
> like to know how does it work 'from the inside'.

connectTo is in the Socket library, and it is implemented in terms of
the lower level primitives from SocketPrim.  It takes a hostname and
port, and returns a normal Haskell Handle, on which you can use hGetLine
and hPutStr as you would with a file or pipe.  This is easiest way to
open up a connection to a server and communicate with it.

> - I also would like to know what does the function readSocket (from
> SocketPrim) return. 

I don't recommend using readSocket.  Using the normal Haskell I/O
functions with a socket Handle should be enough.