socket question
Volker Stolz
Volker Stolz <stolz@hyperion.informatik.rwth-aachen.de>
Mon, 11 Feb 2002 10:53:10 +0100
In local.glasgow-haskell-users, you wrote:
> 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?
>
>> connect cfg = withSocketsDo $
>> do h <- connectTo (remoteAddr cfg) (Service (remoteType cfg))
>> hWaitForInput h 1000
>> s <- readWhileAvailable h
>> return s
Why don't you use hGetLine? FTP is line based, so you just have
to loop until there's no dash in the response.
--
Wonderful \hbox (0.80312pt too nice) in paragraph at lines 16--18
Volker Stolz * stolz@i2.informatik.rwth-aachen.de
Please use PGP or S/MIME for correspondence!