|Arc Cross Reference|
[procedure] open-socket port
[procedure] socket-accept socket
Opens TCP server socket, and accepts connections to it.
(xdef 'open-socket (lambda (num) (tcp-listen num 50 #t)))
socket-accept takes the listening socket, and blocks until a client connects to it. Returns list of three elements: an input port and an output port to talk to the client, and a string representation of the client's IP address.
(xdef 'socket-accept (lambda (s) (call-with-values (lambda () (tcp-accept s)) (lambda (in out) (list (make-limited-input-port in 100000 #t) out (let-values (((us them) (tcp-addresses out))) them))))))