aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2014-12-28 21:10:31 +0100
committerDrahflow <drahflow@gmx.de>2014-12-28 21:10:31 +0100
commit16ccad853b6577d3508e83270054f9e8d34caa22 (patch)
treec3d9b7ada12eecfe4ecc3089293ad59a496e7f33
parent33465b6d99903674b365cce8c036cd42b4d6645e (diff)
Better bufferedEpollServer docs
-rw-r--r--doc/server.md20
1 files changed, 19 insertions, 1 deletions
diff --git a/doc/server.md b/doc/server.md
index 4d4f6df..6f45389 100644
--- a/doc/server.md
+++ b/doc/server.md
@@ -43,7 +43,7 @@ bytes to read and returns a string of the actually read bytes or the empty strin
if the connection ended. The member `write` takes a string and writes it to the
connection - returning the number of bytes written. `close` immediately closes
the connection and `ctl` takes a new set of flags `bor`'ed together from
-`sys .linux .epoll .EPOLLIN`, `.EPOLLOUT`, and `.EPOLLERR` respectively.
+`sys .linux .epoll .EPOLLIN`, `.EPOLLOUT`, and `.EPOLLERR`.
`interval`: Takes a function which provides the number of microseconds to sleep
during the next epoll_wait(2) syscall.
@@ -81,6 +81,24 @@ yet be handled (i.e. pars whatever prefix you like and return the rest), `err` i
called when an error occurs on the connection and `end` is called when the remote
end closes the connection.
+ net .alg .bufferedEpollServer "+" via
+ { 8000 } +port
+ { ":" via
+ # available methods are :read, :write, :close, :finish
+
+ "Welcome to server\n" :write
+
+ <
+ { ==s
+ { s len 4 ge } { "4 chars by you: " 4 s str .prefix cat "\n" cat :write 4 s str .postfix =s } loop
+ s
+ } =*in
+ { "Bye..." :write :finish } =*end
+ { "Error" die } =*err
+ >
+ } +accept
+ +run
+
`net .alg .bufferedEpollServer` takes the same options as `net .alg .epollServer`
and additionally provides `outputBufferLimit` which takes a function which
returns the maximum number of output buffer bytes you are willing to keep