Last active
April 5, 2016 19:35
-
-
Save amalloy/4ce60d93dd82e6aa8dec8e90e4796230 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
writeAll :: Socket -> String -> IO () | |
writeAll socket s = do | |
sent <- send socket s | |
case drop sent s of | |
"" -> return () | |
s -> writeAll socket s | |
echo :: Socket -> IO () | |
echo client = do | |
input <- recv client 4096 | |
if null input | |
then close client | |
else writeAll client input >> echo client |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment