[Openmcl-devel] How can I detect a client closed its connection to a listener socket?
andreas at atp-media.de
Mon Nov 30 07:00:26 PST 2015
I wrote the following bit of code:
(defvar *test-socket* nil)
(defun test-listener ()
(let ((stream (ccl:accept-connection *test-socket*
:stream-args '(:external-format :iso-8859-1))))
(adt:record :dbg "connect test")
(loop :unless (ccl:stream-eofp stream) :do (sleep 0.2))
(adt:record :dbg "disconnect test"))))
(defun start-test-listener ()
(setf *test-socket* (ccl:make-socket :local-port 4010
:connect :passive :reuse-address t :keepalive t))
(ccl:process-run-function "Test Listener" 'test-listener))
(defvar *test-stream* nil)
(defun connect-test ()
(setf *test-stream* (ccl:make-socket :remote-host "127.0.0.1"
adt:record just prints to my slime-repl. I start the listener using
start-test-listener connect a client via connect-test. "connect test"
appears within my slime window. I do a (close *test-stream*) but nothing
happens. (ccl:tream-eofp stream) never returns true and thus the loop never
ends and no "disconnect test" can appear. Is there a way to solve this? How
do I detect, the client has closed the connection?
Thankful for any hint or help.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Openmcl-devel