2017-09-29

(sph server fibers)

a generic socket data processing server that uses fibers for parallel request processing and non-blocking port input/output.

library description

fibers are cooperative, event-driven user threads. there can be multiple active fibers per kernel thread.

see https://github.com/wingo/fibers/wiki/Manual for details and caveats.

starting the server with server-listen makes it listen on an existing or newly created socket.

if there is a new connection on the socket, a user supplied procedure is called with a client port to receive and send data

import name

(sph server fibers)

exports

server-listen-fibers

procedure

signature

handle-request socket #:parallelism ->

description

procedure:{port:client -> unspecified} port:socket [#:parallelism integer/false]

starts a server with a new fibers scheduler.

the server is stopped when it receives the signal SIGINT or SIGTERM.

currently all exceptions are catched automatically by (fibers) and

printed and the server continues listening

server-socket-fibers

procedure

signature

address #:port #:type #:protocol #:set-options ->

description

create a non-blocking socket that works with server-listen-fibers

sph-server-fibers-description

variable

tags: guile documentation library scheme sph-lib computer sph-server-fibers