This works on an earlier CCL: Welcome to Clozure Common Lisp Version 1.10-r16196 (LinuxX8664)!
(let* ((host "localhost") (port 1111) (server-sock (usocket:socket-connect nil nil :protocol ':datagram :local-host host :local-port port)) (client-sock (usocket:socket-connect host port :protocol ':datagram)) (octet-vector (make-array 2 :element-type '(unsigned-byte 8) :initial-contents `(,(char-code #\O) ,(char-code #\K)))) (recv-octet-vector (make-array 2 :element-type '(unsigned-byte 8)))) (usocket:socket-send client-sock octet-vector 2) (usocket:socket-receive server-sock recv-octet-vector 2) (prog1 (and (equalp octet-vector recv-octet-vector) recv-octet-vector) (usocket:socket-close server-sock) (usocket:socket-close client-sock)))
=>
#(79 75)
On trunk CCL, updated/built on 5/19/15: Welcome to Clozure Common Lisp Version 1.11-dev-r16393M-trunk (DarwinX8664)!
It gets an error:
Debug: The condition Invalid argument (error #22) during attempt to connect to [unparsed, AF 2] occurred. While executing: (:INTERNAL SWANK::INVOKE-DEFAULT-DEBUGGER), in process repl-thread(12). Type :POP to abort, :R for a list of available restarts. Type :? for other options.
1 > :b
(24034210) : 0 (FUNCALL #'#<(:INTERNAL SWANK::INVOKE-DEFAULT-DEBUGGER)>) 53 (24034230) : 1 (FUNCALL #'#<SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK> NIL #<COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::INVOKE-DEFAULT-DEBUGGER) #x302002623FFF>) 181 (240342B8) : 2 (CALL-WITH-DEBUGGER-HOOK NIL #<COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::INVOKE-DEFAULT-DEBUGGER) #x302002623FFF>) 181 (240342E8) : 3 (INVOKE-DEFAULT-DEBUGGER #<USOCKET:UNKNOWN-ERROR #x30200250C31D>) 189 (24034308) : 4 (SWANK-DEBUGGER-HOOK #<USOCKET:UNKNOWN-ERROR #x30200250C31D> #<Compiled-function SWANK:SWANK-DEBUGGER-HOOK #x3020008ADAEF>) 565 (24034338) : 5 (BREAK-LOOP-HANDLE-ERROR #<USOCKET:UNKNOWN-ERROR #x30200250C31D> 75524225) 637 (240343E0) : 6 (%ERROR #<USOCKET:UNKNOWN-ERROR #x30200250C31D> (:SOCKET NIL :REAL-ERROR #<SOCKET-CREATION-ERROR #x30200250D79D>) 75524225) 333 (24034408) : 7 (RAISE-ERROR-FROM-ID :UNKNOWN NIL #<SOCKET-CREATION-ERROR #x30200250D79D>) 213 (24034438) : 8 (HANDLE-CONDITION #<SOCKET-CREATION-ERROR #x30200250D79D> NIL) 709 (24034470) : 9 (FUNCALL #'#<(:INTERNAL USOCKET:SOCKET-CONNECT)> #<SOCKET-CREATION-ERROR #x30200250D79D>) 61 (24034490) : 10 (SIGNAL #<SOCKET-CREATION-ERROR #x30200250D79D>) 981 (240344E8) : 11 (%ERROR #<SOCKET-CREATION-ERROR #x30200250D79D> NIL 75524258) 117 (24034510) : 12 (SOCKET-ERROR NIL "connect" 22 NIL :CONNECT-ADDRESS #<SOCKET-ADDRESS [unparsed, AF 2]>) 1053 (24034580) : 13 (INET-CONNECT 20 16777343 22276 NIL) 637 (240345C8) : 14 (SOCKET-CONNECT "localhost" 1111 :PROTOCOL :DATAGRAM :ELEMENT-TYPE NIL :TIMEOUT NIL :DEADLINE NIL :NODELAY NIL :LOCAL-HOST NIL :LOCAL-PORT NIL) 1149 (24034690) : 15 (FUNCALL #'#<Anonymous Function #x30200250E67F>) 149 (240346A8) : 16 (CHEAP-EVAL (LET* (# # # # # ...) (USOCKET:SOCKET-SEND CLIENT-SOCK OCTET-VECTOR 2) (USOCKET:SOCKET-RECEIVE SERVER-SOCK RECV-OCTET-VECTOR 2) (PROG1 # # #))) 101
What's up with that?
Thanks,
Mark