Library
Module
Module type
Parameter
Class
Class type
Make a Line Printer daemon according to the configuration C
.
The functions are splitted to offer various points where threads can be launched.
val socket : ?port:int -> unit -> Unix.file_descr
socket ?port ()
creates a socket for the LPD daemon.
val accept :
?thread:((unit -> unit) -> unit) ->
Unix.file_descr ->
(Unix.sockaddr -> Socket.in_channel -> Socket.out_channel -> unit) ->
'a
accept ?thread socket f
listen on socket
and, for each authorized connection (see C.authorized_host
), runs f addr inchan outchan
where addr
is the address of the connecting machine and inchan
, outchan
are buffered communication channels connected to the client. accept
never returns normally.
val daemon : Unix.sockaddr -> Socket.in_channel -> Socket.out_channel -> unit
deamon addr inchan outchan
will read LPD queries on inchan
and send replies on outchan
. The particular treatement each query receives is determined by C.queues
. addr
is the address of the client. This function is typically used as accept (socket()) daemon
.