]> gitweb.factorcode.org Git - factor.git/commitdiff
echo-server: change to binary echo.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 6 Aug 2012 22:51:52 +0000 (15:51 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 6 Aug 2012 22:51:52 +0000 (15:51 -0700)
extra/echo-server/echo-server.factor

index 08d1b8abf0ed35d3fb81692c9621320563ba5180..3807b8cee7e12f3e66bb2d64c47f1ded8870d91d 100644 (file)
@@ -1,15 +1,15 @@
 ! Copyright (C) 2012 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license.
 
-USING: accessors kernel io io.encodings.utf8 io.servers ;
+USING: accessors kernel io io.encodings.binary io.servers ;
 
 IN: echo-server
 
 : echo-loop ( -- )
-    readln [ write "\r\n" write flush echo-loop ] when* ;
+    1024 read-partial [ write flush echo-loop ] when* ;
 
 : <echo-server> ( port -- server )
-    utf8 <threaded-server>
+    binary <threaded-server>
         swap >>insecure
         "echo.server" >>name
         [ echo-loop ] >>handler ;