
suppose i want to write a stupid ftp client, i want to connect to the ftp server, wait for it to give it's intro stuff (welcome to blah, username: ) and then it wants input. how do i do something like this? so far, i have (don't laugh, this is the first socket haskell program i've written. ever.)
connect cfg = withSocketsDo $ do h <- connectTo (remoteAddr cfg) (Service (remoteType cfg)) hWaitForInput h 1000 s <- readWhileAvailable h return s
readWhileAvailable h = do b <- hReady h if b then do c <- hGetChar h s <- readWhileAvailable h return (c : s) else do return []
but this doesn't seem to ever halt :) if i get rid of the hWaitForInput, it returns immediately with nothing. if i replace hWaitForInput...readWhileAvailable with "s <- getContents h ; return (take 10 s)" i get the beginning of the intro message (so it is connecting properly). please someone help me :) -- Hal Daume III "Computer science is no more about computers | hdaume@isi.edu than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume