diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/world/net/tcp.jvm.lux | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/stdlib/source/lux/world/net/tcp.jvm.lux b/stdlib/source/lux/world/net/tcp.jvm.lux index 3b664d9d8..fbdf47720 100644 --- a/stdlib/source/lux/world/net/tcp.jvm.lux +++ b/stdlib/source/lux/world/net/tcp.jvm.lux @@ -67,34 +67,34 @@ output (Socket::getOutputStream socket)] (wrap (: (TCP IO) (structure (def: (read size) - (do (error.with-error io.monad) + (do (error.with io.monad) [#let [data (binary.create size)] bytes-read (InputStream::read data +0 (.int size) input)] (wrap [(.nat bytes-read) data]))) (def: (write data) - (do (error.with-error io.monad) + (do (error.with io.monad) [_ (OutputStream::write data +0 (.int (binary.size data)) output)] (Flushable::flush output))) (def: (close _) - (do (error.with-error io.monad) + (do (error.with io.monad) [_ (AutoCloseable::close input) _ (AutoCloseable::close output)] (AutoCloseable::close socket)))))))) (def: #export (client address port) (-> //.Address //.Port (IO (Error (TCP IO)))) - (do (error.with-error io.monad) + (do (error.with io.monad) [socket (Socket::new address (.int port))] (io.io (tcp socket)))) (def: #export (server port) (-> //.Port (IO (Error [(Promise Any) (frp.Channel (TCP IO))]))) - (do (error.with-error io.monad) + (do (error.with io.monad) [server (ServerSocket::new (.int port)) #let [close-signal (: (Promise Any) (promise #.None)) @@ -107,7 +107,7 @@ (promise.future (loop [_ []] (do io.monad - [?client (do (error.with-error io.monad) + [?client (do (error.with io.monad) [socket (ServerSocket::accept server)] (io.io (tcp socket)))] (case ?client |