hey guys !

Iīm pretty nu to haskell, and i got the following things to do:

code a client in python that sends string       ->done
code a server in haskell that recieves string   -> to do...

i initialized the server, set up a socket on port 9900,
so the socket is allready open...

First i read the string with hGetLine:


loop socket =
        do      
                (handle, host, port) <- accept socket
                forkIO (client handle)

                loop socket
                

client handle = do
                query <- hGetLine handle


this worked pretty good.

Now my Tutor said, I should code this whole thing with hGetChar
instead of hGetLine...
I ainīt got the clue of an clue how to manage this...
I worked something out like:

client handle = do
                  query <- hGetChar handle
                  if query = [] then return(0)
                  else
                  let list = list ++ query

I donīt know where the string is stored in the handle,
and how to read it out...I mean, I canīt use stuff like
query handle <- hGetChar(firstfrom:query handle)...

Please Help Me !!!


_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to