chickadee » tcp-server » make-tcp-server

make-tcp-server LISTENER THUNK #!optional MAXREQUESTSprocedure

Returns a procedure that, when invoked, will start the TCP server. LISTENER should be a tcp-listener objects as returned by tcp-listen. For every incoming request, a thread will be started and THUNK (a procedure of zero arguments) will be invoked, with the current input- and output-ports bound so that any I/O is done from/to the client connection. If the optional argument MAXREQUESTS is given, then it specifies an upper limit for currently executing requests. The returned server procedure accepts an optional argument that indicates whether some diagnostic messages for incoming requests should be written to the value of (current-error-port). The optional argument may be a string (which will prefix each diagnostic message), or just #t (which results in a default prefix).