Plaster
New
List
Login
common-lisp
default
anonymous
2019.09.10 19:46:29
(defun create-output-connection (tcp-port-output) "Creates a valid connected socket and sets *REMOTE-SERVER-CONNECTION-STREAM* to it. Uses the value of *remote-peer-ip* which is set by (maintain-connection-input) if this value has not been set, this function will just loop until it is eventually set. The value of *remote-server-connection-stream* being set to a valid socket is vital for the operation of the program " (handler-case (unwind-protect (let ((socket (socket-connect *REMOTE-PEER-IP* tcp-port-output :protocol :stream ))) (setf *REMOTE-SERVER-CONNECTION-STREAM* socket)) (when *REMOTE-SERVER-CONNECTION-STREAM* (usocket:socket-close *REMOTE-SERVER-CONNECTION-STREAM*))) (USOCKET:CONNECTION-REFUSED-ERROR (condition) (format *standard-output* "CONNECTION REFUSED ~A~% RETRYING IN 1 SECOND~%" condition) (sleep 1) (create-output-connection tcp-port-output))))
Raw
Annotate
Repaste
Edit