mirror of
https://github.com/janet-lang/janet
synced 2025-10-11 22:07:43 +00:00
Improve reading and writing from streams.
Handle errors earlier, and allow 0 length packets from UDP but not from TCP. This should more closely follow the exact specs of send and recv calls.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
(def b @"")
|
||||
(print "Connection " id "!")
|
||||
(while (:read stream 1024 b)
|
||||
(repeat 10 (print "work for " id " ...") (ev/sleep 1))
|
||||
(repeat 10 (print "work for " id " ...") (ev/sleep 0.1))
|
||||
(:write stream b)
|
||||
(buffer/clear b))
|
||||
(printf "Done %v!" id)))
|
||||
|
Reference in New Issue
Block a user