@@ -36,11 +36,11 @@ (use nanomsg srfi-18) ;;start a server, returns the connection ;; -(define (nmsg:start-server portnum ) +(define (nmsg:start-server portnum) (let ((rep (nn-socket 'rep))) (handle-exceptions exn (let ((emsg ((condition-property-accessor 'exn 'message) exn))) (print "ERROR: Failed to start server \"" emsg "\"") @@ -53,19 +53,18 @@ ;; to take an action on failure use proc which is called with the error info ;; (proc exn errormsg) ;; ;; returns the response or #f if no response within timeout ;; -(define (nmsg:open-send-close host-port msg attrib #!key (timeout 3)(proc #f)) ;; default timeout is 3 seconds +(define (nmsg:open-send-close host-port msg #!key (timeout 3)(proc #f)) ;; default timeout is 3 seconds (let ((req (nn-socket 'req)) (uri (conc "tcp://" host-port)) - (res #f) - (mode (alist-ref 'mode attrib))) + (res #f)) (handle-exceptions exn (let ((emsg ((condition-property-accessor 'exn 'message) exn))) - ;; Send notification + ;; call proc on fail (if proc (proc exn emsg)) #f) (nn-connect req uri) (print "Connected to the server " ) (nn-send req msg)