body) ;; Bind socket from `socket-filename' to new lexical variable `socket-name' and run (progn @body), then relase the socket afterwards. If the socket fails to bind, return nil and do not attempt to execute body.
body)
;; Bind socket from `socket-filename' to new lexical variable `socket-name' and run (progn @body), then relase the socket afterwards. If the socket fails to bind, return nil and do not attempt to execute body.
;; Add `:connect' after socket-filename to connect instead of binding.
;client functions
sipc:connect(file) ;; connect to socket `file', returns sd on success, nil on failure.
sipc:send(sd value &ptional type) ;; send `value' to socket `sd' (optionally specify type (see above types), default :string)
;; :string -- value expected to be a string
;; :binary --value expected to be `pointer' struct
;; :close -- value ignored
sipc:send-quick(file value &optional type) ;; send `value' to socket file `file'
See `cl-sipc.lisp' for more documentation.
Pointers:
(sipc:make-pointer :memory cffi-pointer :size size) ;; Make from CFFI foreign-pointer with size
(sipc:pointer-free ptr) ;; Free pointer
(sipc:with-pointer (name &optional type cffi-type) value body...) ;; allocate pointer from value with type and lexical name. free after body.
;; type:
;; :string -- expects Lisp string
;; :sequence -- expects list or vector
;; :single -- expects single value
;; :infer (defualt) -- infer from value
;; optionally specify cffi type (default :unsigned-char)
(see pointer.lisp for more info)
---
Other installation options
@ -70,8 +92,6 @@ Terminal 1:
---
TODO: Implement message sending wrapper.
TODO: Internal error handling.
TODO: Have libsipc built on system load
TODO: Change :binary message from pointer to vector (or at least pass size to handler so it's usable).
#'(lambda(typemessage);; Callback ran when a message is received
(formatt" <- (~a) ~a~%"typemessage);;print the message & type
(if(eqltype:binary)
(formatt" <- (~a) ~a (size: ~a)~%"type(sipc:pointer-to-arraymessage)(sipc:pointer-sizemessage));;print the binary message as an array of bytes, the type, & the size
(formatt" <- (~a) ~a~%"typemessage));;print the message & type
(not(eql:closetype))))));;returning NIL if the type is :CLOSE to stop the listener
(formatt"[-] listen rc ~a~%"rc)
(cl-sipc:release*socket*));;finally, release the socket