From ctian at common-lisp.net Sat Feb 4 04:31:27 2012 From: ctian at common-lisp.net (ctian at common-lisp.net) Date: Fri, 03 Feb 2012 20:31:27 -0800 Subject: [usocket-cvs] r683 - in usocket/trunk: . backend Message-ID: Author: ctian Date: Fri Feb 3 20:31:26 2012 New Revision: 683 Log: [LispWorks] SOCKET-CONNECT shouldn't have *auto-port* as its default value, this is not supported by LispWorks 6.1 any more. (Thanks to Raymond Wiker) Modified: usocket/trunk/CHANGES usocket/trunk/backend/lispworks.lisp Modified: usocket/trunk/CHANGES ============================================================================== --- usocket/trunk/CHANGES Sat Jan 28 12:49:31 2012 (r682) +++ usocket/trunk/CHANGES Fri Feb 3 20:31:26 2012 (r683) @@ -3,8 +3,9 @@ * New feature: SOCKET-OPTION for seting and geting various socket options. * Enhancement: SOCKET-CONNECT argument :nodelay now support :if-supported as value (patch from Anton Vodonosov). * Enhancement: Add *remote-host* *remote-port* to SOCKET-SERVER stream handler (suggested by Matthew Curry). -* Bugfix: [LispWorks] Fixed UDP support for LispWorks 6.1 (patch from Camille Troillard). +* Bugfix: [LispWorks] Fixed UDP support for LispWorks 6.1 (patch from Camille Troillard by Martin Simmons). * Bugfix: [LispWorks] Stop using hcl:add-special-free-action for reclaiming unused UDP socket fds to improve multi-threading stablity (suggested by Camille Troillard). +* Bugfix: [LispWorks] Fixed SOCKET-CONNECT on Windows, now LOCAL-PORT never have *auto-port* (0) as default value. 0.5.4: @@ -62,3 +63,4 @@ [TODO for 0.6.x] * New feature: SOCKET-SHUTDOWN for TCP and UDP sockets +* Fix UDP in CCL 1.7 Windows |send| symbol is gone. Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp Sat Jan 28 12:49:31 2012 (r682) +++ usocket/trunk/backend/lispworks.lisp Fri Feb 3 20:31:26 2012 (r683) @@ -289,7 +289,7 @@ (defun socket-connect (host port &key (protocol :stream) (element-type 'base-char) timeout deadline (nodelay t nodelay-specified) - local-host (local-port #+win32 *auto-port* #-win32 nil)) + local-host local-port) ;; What's the meaning of this keyword? (when deadline From ctian at common-lisp.net Sat Feb 4 10:35:45 2012 From: ctian at common-lisp.net (ctian at common-lisp.net) Date: Sat, 04 Feb 2012 02:35:45 -0800 Subject: [usocket-cvs] r684 - in usocket/trunk: . backend vendor Message-ID: Author: ctian Date: Sat Feb 4 02:35:44 2012 New Revision: 684 Log: [CCL] move the implementation of SOCKET-SEND from ccl-send.lisp to openmcl.lisp, with offset support. Deleted: usocket/trunk/vendor/ccl-send.lisp Modified: usocket/trunk/CHANGES usocket/trunk/backend/openmcl.lisp usocket/trunk/usocket.asd Modified: usocket/trunk/CHANGES ============================================================================== --- usocket/trunk/CHANGES Fri Feb 3 20:31:26 2012 (r683) +++ usocket/trunk/CHANGES Sat Feb 4 02:35:44 2012 (r684) @@ -1,6 +1,7 @@ 0.6.0: -* New feature: SOCKET-OPTION for seting and geting various socket options. +* New feature: SOCKET-OPTION and (setf SOCKET-OPTION) for seting and geting various socket options. +* (on the way) New feature: SOCKET-SHUTDOWN for TCP and UDP sockets. * Enhancement: SOCKET-CONNECT argument :nodelay now support :if-supported as value (patch from Anton Vodonosov). * Enhancement: Add *remote-host* *remote-port* to SOCKET-SERVER stream handler (suggested by Matthew Curry). * Bugfix: [LispWorks] Fixed UDP support for LispWorks 6.1 (patch from Camille Troillard by Martin Simmons). @@ -59,8 +60,3 @@ * New feature: CLISP support some advanced TCP features which CLISP's SOCKET interface not provide * New feature: Macintosh Common Lisp (MCL) support Datagram sockets (UDP) - -[TODO for 0.6.x] - -* New feature: SOCKET-SHUTDOWN for TCP and UDP sockets -* Fix UDP in CCL 1.7 Windows |send| symbol is gone. Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp Fri Feb 3 20:31:26 2012 (r683) +++ usocket/trunk/backend/openmcl.lisp Sat Feb 4 02:35:44 2012 (r684) @@ -149,14 +149,24 @@ (with-mapped-conditions (usocket) (close (socket usocket)))) -(defmethod socket-send ((usocket datagram-usocket) buffer length &key host port) +(defmethod socket-send ((usocket datagram-usocket) buffer length &key host port offset) (with-mapped-conditions (usocket) (if (and host port) (openmcl-socket:send-to (socket usocket) buffer length :remote-host (host-to-hbo host) :remote-port port) - ;; following functino was defined in "vendor/ccl-send.lisp" - (ccl::send-for-usocket (socket usocket) buffer length)))) + ;; Clozure CL's socket function SEND-TO doesn't support operations on connected UDP sockets, + ;; so we have to define our own. + (let* ((socket (socket usocket)) + (fd (ccl::socket-device socket))) + (multiple-value-setq (buffer offset) + (ccl::verify-socket-buffer buffer offset length)) + (ccl::%stack-block ((bufptr length)) + (ccl::%copy-ivector-to-ptr buffer offset bufptr 0 length) + (ccl::socket-call socket "send" + (ccl::with-eagain fd :output + (ccl::ignoring-eintr + (ccl::check-socket-error (#_send fd bufptr length 0)))))))))) (defmethod socket-receive ((usocket datagram-usocket) buffer length &key) (with-mapped-conditions (usocket) Modified: usocket/trunk/usocket.asd ============================================================================== --- usocket/trunk/usocket.asd Fri Feb 3 20:31:26 2012 (r683) +++ usocket/trunk/usocket.asd Sat Feb 4 02:35:44 2012 (r684) @@ -16,7 +16,6 @@ (:module "vendor" :depends-on ("package") :components ((:file "split-sequence") #+mcl (:file "kqueue") - #+openmcl (:file "ccl-send") (:file "spawn-thread"))) (:file "usocket" :depends-on ("vendor")) (:file "condition" :depends-on ("usocket")) From ctian at common-lisp.net Sat Feb 4 15:56:01 2012 From: ctian at common-lisp.net (ctian at common-lisp.net) Date: Sat, 04 Feb 2012 07:56:01 -0800 Subject: [usocket-cvs] r685 - in usocket/trunk: . backend Message-ID: Author: ctian Date: Sat Feb 4 07:56:00 2012 New Revision: 685 Log: [UDP] SOCKET-SEND now support an CCL-like OFFSET keyword for sending only parts of the whole buffer. Modified: usocket/trunk/CHANGES usocket/trunk/backend/abcl.lisp usocket/trunk/backend/allegro.lisp usocket/trunk/backend/clisp.lisp usocket/trunk/backend/cmucl.lisp usocket/trunk/backend/lispworks.lisp usocket/trunk/backend/openmcl.lisp usocket/trunk/backend/sbcl.lisp usocket/trunk/backend/scl.lisp Modified: usocket/trunk/CHANGES ============================================================================== --- usocket/trunk/CHANGES Sat Feb 4 02:35:44 2012 (r684) +++ usocket/trunk/CHANGES Sat Feb 4 07:56:00 2012 (r685) @@ -1,6 +1,7 @@ 0.6.0: * New feature: SOCKET-OPTION and (setf SOCKET-OPTION) for seting and geting various socket options. +* New feature: [UDP] SOCKET-SEND now support an CCL-like OFFSET keyword for sending only parts of the whole buffer. * (on the way) New feature: SOCKET-SHUTDOWN for TCP and UDP sockets. * Enhancement: SOCKET-CONNECT argument :nodelay now support :if-supported as value (patch from Anton Vodonosov). * Enhancement: Add *remote-host* *remote-port* to SOCKET-SERVER stream handler (suggested by Matthew Curry). Modified: usocket/trunk/backend/abcl.lisp ============================================================================== --- usocket/trunk/backend/abcl.lisp Sat Feb 4 02:35:44 2012 (r684) +++ usocket/trunk/backend/abcl.lisp Sat Feb 4 07:56:00 2012 (r685) @@ -335,19 +335,17 @@ (code-char ub8) ub8))) -(defmethod socket-send ((usocket datagram-usocket) buffer length &key host port) +(defmethod socket-send ((usocket datagram-usocket) buffer size &key host port (offset 0)) (let* ((socket (socket usocket)) - (real-length (or length (length buffer))) - (byte-array (jnew-array $*byte real-length)) + (byte-array (jnew-array $*byte size)) (packet (if (and host port) - (jnew $%DatagramPacket/5 byte-array 0 real-length (host-to-inet4 host) port) - (jnew $%DatagramPacket/3 byte-array 0 real-length)))) + (jnew $%DatagramPacket/5 byte-array 0 size (host-to-inet4 host) port) + (jnew $%DatagramPacket/3 byte-array 0 size)))) ;; prepare sending data - (loop for i from 0 below real-length + (loop for i from offset below (+ size offset) do (setf (jarray-ref byte-array i) (*->byte (aref buffer i)))) (with-mapped-conditions (usocket) - (jcall $@send/1 socket packet)) - real-length)) + (jcall $@send/1 socket packet)))) ;;; TODO: return-host and return-port cannot be get ... (defmethod socket-receive ((usocket datagram-usocket) buffer length Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp Sat Feb 4 02:35:44 2012 (r684) +++ usocket/trunk/backend/allegro.lisp Sat Feb 4 07:56:00 2012 (r685) @@ -151,10 +151,16 @@ (values (get-peer-address usocket) (get-peer-port usocket))) -(defmethod socket-send ((socket datagram-usocket) buffer length &key host port) +(defmethod socket-send ((socket datagram-usocket) buffer size &key host port (offset 0)) (with-mapped-conditions (socket) (let ((s (socket socket))) - (socket:send-to s buffer length :remote-host host :remote-port port)))) + (socket:send-to s + (if (zerop offset) + buffer + (subseq buffer offset (+ offset size))) + size + :remote-host host + :remote-port port)))) (defmethod socket-receive ((socket datagram-usocket) buffer length &key) (declare (values (simple-array (unsigned-byte 8) (*)) ; buffer Modified: usocket/trunk/backend/clisp.lisp ============================================================================== --- usocket/trunk/backend/clisp.lisp Sat Feb 4 02:35:44 2012 (r684) +++ usocket/trunk/backend/clisp.lisp Sat Feb 4 07:56:00 2012 (r685) @@ -93,10 +93,12 @@ "Dispatch correct usocket condition." (let (error-keyword error-string) (typecase condition + #+ffi ; because OS:ERRNO and OS:STRERROR is only present if FFI is present. (system::simple-os-error (let ((errno (car (simple-condition-format-arguments condition)))) (setq error-keyword (os:errno errno) error-string (os:strerror errno)))) + #+ffi ; because OS:ERRNO and OS:STRERROR is only present if FFI is present. (simple-error (let ((keyword (car (simple-condition-format-arguments condition)))) @@ -302,7 +304,7 @@ host port)))) - (defmethod socket-send ((socket datagram-usocket) buffer length &key host port) + (defmethod socket-send ((socket datagram-usocket) buffer size &key host port (offset 0)) "Returns the number of octets sent." (let* ((sock (socket socket)) (sockaddr (when (and host port) @@ -311,19 +313,19 @@ (make-sockaddr_in) (host-byte-order host) port)))) - (real-length (or length (length buffer))) + (real-size (min size +max-datagram-packet-size+)) (real-buffer (if (typep buffer '(simple-array (unsigned-byte 8) (*))) buffer - (make-array real-length + (make-array real-size :element-type '(unsigned-byte 8) - :initial-contents (subseq buffer 0 real-length)))) + :initial-contents (subseq buffer 0 real-size)))) (rv (if (and host port) (rawsock:sendto sock real-buffer sockaddr - :start 0 - :end real-length) + :start offset + :end (+ offset real-size)) (rawsock:send sock real-buffer - :start 0 - :end real-length)))) + :start offset + :end (+ offset real-size))))) rv)) (defmethod socket-close ((usocket datagram-usocket)) @@ -631,30 +633,31 @@ ;; in LispWorks. So, we allocate new foreign buffer for holding data (unknown sequence subtype) every time. ;; ;; I don't know if anyone is watching my coding work, but I think this design is reasonable for CLISP. - (defmethod socket-send ((usocket datagram-usocket) buffer length &key host port) + (defmethod socket-send ((usocket datagram-usocket) buffer size &key host port (offset 0)) (declare (type sequence buffer) - (type integer length)) - (let ((remote-address (when (and host port) - (fill-sockaddr_in (ffi:allocate-shallow 'sockaddr_in) host port))) - (send-buffer (let ((buffer-length (length buffer))) - (if (> buffer-length (* length 2)) - ;; if buffer is too big, then we copy out a subseq and only allocate as need - (ffi:allocate-deep 'ffi:uint8 (subseq buffer 0 length) :count length :read-only t) - ;; then we allocate the whole buffer directly, that should be faster. - (ffi:allocate-deep 'ffi:uint8 buffer :count (length buffer) :read-only t)))) - (real-length (min length +max-datagram-packet-size+)) + (type (integer 0 *) size offset)) + (let ((remote-address + (when (and host port) + (fill-sockaddr_in (ffi:allocate-shallow 'sockaddr_in) host port))) + (send-buffer + (ffi:allocate-deep 'ffi:uint8 + (if (zerop offset) + buffer + (subseq buffer offset (+ offset size))) + :count size :read-only t)) + (real-size (min size +max-datagram-packet-size+)) (nbytes 0)) (unwind-protect (let ((n (if remote-address (%sendto (socket usocket) (ffi:foreign-address send-buffer) - real-length + real-size 0 ; flags (ffi:cast (ffi:foreign-value remote-address) 'sockaddr) *length-of-sockaddr_in*) (%send (socket usocket) (ffi:foreign-address send-buffer) - real-length + real-size 0)))) (cond ((plusp n) (setq nbytes n)) Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp Sat Feb 4 02:35:44 2012 (r684) +++ usocket/trunk/backend/cmucl.lisp Sat Feb 4 07:56:00 2012 (r685) @@ -174,14 +174,17 @@ length flags)) -(defmethod socket-send ((usocket datagram-usocket) buffer length &key host port) +(defmethod socket-send ((usocket datagram-usocket) buffer size &key host port (offset 0) + &aux (real-buffer (if (zerop offset) + buffer + (subseq buffer offset (+ offset size))))) (with-mapped-conditions (usocket) (if (and host port) - (ext:inet-sendto (socket usocket) buffer length (host-to-hbo host) port) + (ext:inet-sendto (socket usocket) real-buffer size (host-to-hbo host) port) #-unicode - (unix:unix-send (socket usocket) buffer length 0) + (unix:unix-send (socket usocket) real-buffer size 0) #+unicode - (%unix-send (socket usocket) buffer length 0)))) + (%unix-send (socket usocket) real-buffer size 0)))) (defmethod socket-receive ((usocket datagram-usocket) buffer length &key) (declare (values (simple-array (unsigned-byte 8) (*)) ; buffer Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp Sat Feb 4 02:35:44 2012 (r684) +++ usocket/trunk/backend/lispworks.lisp Sat Feb 4 07:56:00 2012 (r685) @@ -423,28 +423,27 @@ (defvar *length-of-sockaddr_in* (fli:size-of '(:struct comm::sockaddr_in))) -(defun send-message (socket-fd message buffer &optional (length (length buffer)) host service) +(defmethod socket-send ((usocket datagram-usocket) buffer size &key host port (offset 0) + &aux (socket-fd (socket usocket)) + (message (slot-value usocket 'send-buffer))) "Send message to a socket, using sendto()/send()" (declare (type integer socket-fd) (type sequence buffer)) + (when host (setq host (host-to-hbo host))) (fli:with-dynamic-lisp-array-pointer (ptr message :type '(:unsigned :byte)) - (replace message buffer :end2 length) - (if (and host service) + (replace message buffer :start2 offset :end2 (+ offset size)) + (if (and host port) (fli:with-dynamic-foreign-objects () (multiple-value-bind (error family client-addr client-addr-length) - (initialize-dynamic-sockaddr host service "udp") + (initialize-dynamic-sockaddr host port "udp") + (declare (ignore family)) (when error - (error "cannot resolve hostname ~S, service ~S: ~A" - host service error)) - (%sendto socket-fd ptr (min length +max-datagram-packet-size+) 0 + (error "cannot resolve hostname ~S, port ~S: ~A" + host port error)) + (%sendto socket-fd ptr (min size +max-datagram-packet-size+) 0 (fli:copy-pointer client-addr :type '(:struct comm::sockaddr)) client-addr-length))) - (comm::%send socket-fd ptr (min length +max-datagram-packet-size+) 0)))) - -(defmethod socket-send ((socket datagram-usocket) buffer length &key host port) - (send-message (socket socket) - (slot-value socket 'send-buffer) - buffer length (and host (host-to-hbo host)) port)) + (comm::%send socket-fd ptr (min size +max-datagram-packet-size+) 0)))) (defun receive-message (socket-fd message &optional buffer (length (length buffer)) &key read-timeout (max-buffer-size +max-datagram-packet-size+)) Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp Sat Feb 4 02:35:44 2012 (r684) +++ usocket/trunk/backend/openmcl.lisp Sat Feb 4 07:56:00 2012 (r685) @@ -149,24 +149,25 @@ (with-mapped-conditions (usocket) (close (socket usocket)))) -(defmethod socket-send ((usocket datagram-usocket) buffer length &key host port offset) +(defmethod socket-send ((usocket datagram-usocket) buffer size &key host port (offset 0)) (with-mapped-conditions (usocket) (if (and host port) - (openmcl-socket:send-to (socket usocket) buffer length + (openmcl-socket:send-to (socket usocket) buffer size :remote-host (host-to-hbo host) - :remote-port port) + :remote-port port + :offset offset) ;; Clozure CL's socket function SEND-TO doesn't support operations on connected UDP sockets, ;; so we have to define our own. (let* ((socket (socket usocket)) (fd (ccl::socket-device socket))) (multiple-value-setq (buffer offset) - (ccl::verify-socket-buffer buffer offset length)) - (ccl::%stack-block ((bufptr length)) - (ccl::%copy-ivector-to-ptr buffer offset bufptr 0 length) + (ccl::verify-socket-buffer buffer offset size)) + (ccl::%stack-block ((bufptr size)) + (ccl::%copy-ivector-to-ptr buffer offset bufptr 0 size) (ccl::socket-call socket "send" (ccl::with-eagain fd :output (ccl::ignoring-eintr - (ccl::check-socket-error (#_send fd bufptr length 0)))))))))) + (ccl::check-socket-error (#_send fd bufptr size 0)))))))))) (defmethod socket-receive ((usocket datagram-usocket) buffer length &key) (with-mapped-conditions (usocket) Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp Sat Feb 4 02:35:44 2012 (r684) +++ usocket/trunk/backend/sbcl.lisp Sat Feb 4 07:56:00 2012 (r685) @@ -398,11 +398,14 @@ (with-mapped-conditions (usocket) (close (socket-stream usocket)))) -(defmethod socket-send ((socket datagram-usocket) buffer length &key host port) +(defmethod socket-send ((usocket datagram-usocket) buffer size &key host port (offset 0)) (with-mapped-conditions (socket) - (let* ((s (socket socket)) - (dest (if (and host port) (list (host-to-vector-quad host) port) nil))) - (sb-bsd-sockets:socket-send s buffer length :address dest)))) + (let* ((s (socket usocket)) + (dest (if (and host port) (list (host-to-vector-quad host) port) nil)) + (real-buffer (if (zerop offset) + buffer + (subseq buffer offset (+ offset size))))) + (sb-bsd-sockets:socket-send s real-buffer size :address dest)))) (defmethod socket-receive ((socket datagram-usocket) buffer length &key (element-type '(unsigned-byte 8))) Modified: usocket/trunk/backend/scl.lisp ============================================================================== --- usocket/trunk/backend/scl.lisp Sat Feb 4 02:35:44 2012 (r684) +++ usocket/trunk/backend/scl.lisp Sat Feb 4 07:56:00 2012 (r685) @@ -136,14 +136,17 @@ (defmethod socket-close :after ((socket datagram-usocket)) (setf (%open-p socket) nil)) -(defmethod socket-send ((socket datagram-usocket) buffer length &key host port) - (let ((s (socket socket)) - (host (if host (host-to-hbo host)))) +(defmethod socket-send ((usocket datagram-usocket) buffer size &key host port) + (let ((s (socket usocket)) + (host (if host (host-to-hbo host))) + (real-buffer (if (zerop offset) + buffer + (subseq buffer offset (+ offset size))))) (multiple-value-bind (result errno) - (ext:inet-socket-send-to s buffer length + (ext:inet-socket-send-to s real-buffer size :remote-host host :remote-port port) (or result - (scl-map-socket-error errno :socket socket))))) + (scl-map-socket-error errno :socket usocket))))) (defmethod socket-receive ((socket datagram-usocket) buffer length &key) (declare (values (simple-array (unsigned-byte 8) (*)) ; buffer From ctian at common-lisp.net Sat Feb 4 17:48:27 2012 From: ctian at common-lisp.net (ctian at common-lisp.net) Date: Sat, 04 Feb 2012 09:48:27 -0800 Subject: [usocket-cvs] r686 - usocket/trunk/backend Message-ID: Author: ctian Date: Sat Feb 4 09:48:27 2012 New Revision: 686 Log: Fixed a bug in previous commit during argument name changes Modified: usocket/trunk/backend/allegro.lisp usocket/trunk/backend/sbcl.lisp Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp Sat Feb 4 07:56:00 2012 (r685) +++ usocket/trunk/backend/allegro.lisp Sat Feb 4 09:48:27 2012 (r686) @@ -151,9 +151,9 @@ (values (get-peer-address usocket) (get-peer-port usocket))) -(defmethod socket-send ((socket datagram-usocket) buffer size &key host port (offset 0)) - (with-mapped-conditions (socket) - (let ((s (socket socket))) +(defmethod socket-send ((usocket datagram-usocket) buffer size &key host port (offset 0)) + (with-mapped-conditions (usocket) + (let ((s (socket usocket))) (socket:send-to s (if (zerop offset) buffer Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp Sat Feb 4 07:56:00 2012 (r685) +++ usocket/trunk/backend/sbcl.lisp Sat Feb 4 09:48:27 2012 (r686) @@ -399,7 +399,7 @@ (close (socket-stream usocket)))) (defmethod socket-send ((usocket datagram-usocket) buffer size &key host port (offset 0)) - (with-mapped-conditions (socket) + (with-mapped-conditions (usocket) (let* ((s (socket usocket)) (dest (if (and host port) (list (host-to-vector-quad host) port) nil)) (real-buffer (if (zerop offset) From ctian at common-lisp.net Mon Feb 27 14:49:56 2012 From: ctian at common-lisp.net (ctian at common-lisp.net) Date: Mon, 27 Feb 2012 06:49:56 -0800 Subject: [usocket-cvs] r687 - in usocket/branches/0.5.x: . backend Message-ID: Author: ctian Date: Mon Feb 27 06:49:55 2012 New Revision: 687 Log: Align with trunk (to r683), prepare for 0.5.5 Modified: usocket/branches/0.5.x/CHANGES usocket/branches/0.5.x/backend/abcl.lisp usocket/branches/0.5.x/backend/allegro.lisp usocket/branches/0.5.x/backend/clisp.lisp usocket/branches/0.5.x/backend/cmucl.lisp usocket/branches/0.5.x/backend/lispworks.lisp usocket/branches/0.5.x/backend/mcl.lisp usocket/branches/0.5.x/backend/openmcl.lisp usocket/branches/0.5.x/backend/sbcl.lisp usocket/branches/0.5.x/backend/scl.lisp usocket/branches/0.5.x/usocket.lisp Modified: usocket/branches/0.5.x/CHANGES ============================================================================== --- usocket/branches/0.5.x/CHANGES Sat Feb 4 09:48:27 2012 (r686) +++ usocket/branches/0.5.x/CHANGES Mon Feb 27 06:49:55 2012 (r687) @@ -1,3 +1,11 @@ +0.5.5: + +* Enhancement: SOCKET-CONNECT argument :nodelay can now set to :if-supported (patch from Anton Vodonosov). +* Enhancement: [server] adding *remote-host* *remote-port* to socket-server stream handler functions (suggested by Matthew Curry) +* Bugfix: [LispWorks] Fixed UDP support for LispWorks 6.1 (patch from Camille Troillard by Martin Simmons). +* Bugfix: [LispWorks] Stop using hcl:add-special-free-action for reclaiming unused UDP socket fds to improve multi-threading stablity (suggested by Camille Troillard). +* Bugfix: [LispWorks] Fixed SOCKET-CONNECT on Windows, now LOCAL-PORT never have *auto-port* (0) as default value. + 0.5.4: * Bugfix: [ECL] Fixed for ECL's MAKE-BUILD by removing some unecessary code (reported by Juan Jose Garcia-Ripoll, the ECL maintainer) Modified: usocket/branches/0.5.x/backend/abcl.lisp ============================================================================== --- usocket/branches/0.5.x/backend/abcl.lisp Sat Feb 4 09:48:27 2012 (r686) +++ usocket/branches/0.5.x/backend/abcl.lisp Mon Feb 27 06:49:55 2012 (r687) @@ -212,7 +212,8 @@ (setq stream (ext:get-socket-stream socket :element-type element-type) usocket (make-stream-socket :stream stream :socket socket)) (when nodelay-supplied-p - (jcall $@setTcpNoDelay/1 socket (if nodelay +java-true+ +java-false+))) + (jcall $@setTcpNoDelay/1 socket (if nodelay ;; both t and :if-supported mean +java-true+ + +java-true+ +java-false+))) (when timeout (jcall $@setSoTimeout/Socket/1 socket (truncate (* 1000 timeout)))))) (:datagram ; UDP Modified: usocket/branches/0.5.x/backend/allegro.lisp ============================================================================== --- usocket/branches/0.5.x/backend/allegro.lisp Sat Feb 4 09:48:27 2012 (r686) +++ usocket/branches/0.5.x/backend/allegro.lisp Mon Feb 27 06:49:55 2012 (r687) @@ -55,6 +55,8 @@ local-host local-port) (when timeout (unsupported 'timeout 'socket-connect)) (when deadline (unsupported 'deadline 'socket-connect)) + (when (eq nodelay :if-supported) + (setf nodelay t)) (let ((socket)) (setf socket Modified: usocket/branches/0.5.x/backend/clisp.lisp ============================================================================== --- usocket/branches/0.5.x/backend/clisp.lisp Sat Feb 4 09:48:27 2012 (r686) +++ usocket/branches/0.5.x/backend/clisp.lisp Mon Feb 27 06:49:55 2012 (r687) @@ -116,10 +116,11 @@ (defun socket-connect (host port &key (protocol :stream) (element-type 'character) timeout deadline (nodelay t nodelay-specified) local-host local-port) - (declare (ignore nodelay) - (ignorable timeout local-host local-port)) + (declare (ignorable timeout local-host local-port)) (when deadline (unsupported 'deadline 'socket-connect)) - (when nodelay-specified (unsupported 'nodelay 'socket-connect)) + (when (and nodelay-specified + (not (eq nodelay :if-supported))) + (unsupported 'nodelay 'socket-connect)) (case protocol (:stream (let ((socket) Modified: usocket/branches/0.5.x/backend/cmucl.lisp ============================================================================== --- usocket/branches/0.5.x/backend/cmucl.lisp Sat Feb 4 09:48:27 2012 (r686) +++ usocket/branches/0.5.x/backend/cmucl.lisp Mon Feb 27 06:49:55 2012 (r687) @@ -56,10 +56,11 @@ (local-port nil local-port-p) &aux (local-bind-p (fboundp 'ext::bind-inet-socket))) - (declare (ignore nodelay)) (when timeout (unsupported 'timeout 'socket-connect)) (when deadline (unsupported 'deadline 'socket-connect)) - (when nodelay-specified (unsupported 'nodelay 'socket-connect)) + (when (and nodelay-specified + (not (eq nodelay :if-supported))) + (unsupported 'nodelay 'socket-connect)) (when (and local-host-p (not local-bind-p)) (unsupported 'local-host 'socket-connect :minimum "Snapshot 2008-08 (19E)")) (when (and local-port-p (not local-bind-p)) Modified: usocket/branches/0.5.x/backend/lispworks.lisp ============================================================================== --- usocket/branches/0.5.x/backend/lispworks.lisp Sat Feb 4 09:48:27 2012 (r686) +++ usocket/branches/0.5.x/backend/lispworks.lisp Mon Feb 27 06:49:55 2012 (r687) @@ -183,7 +183,47 @@ len) (float (/ (fli:dereference timeout) 1000)))) -(defun open-udp-socket (&key local-address local-port read-timeout) +(defun initialize-dynamic-sockaddr (hostname service protocol &aux (original-hostname hostname)) + (declare (ignorable original-hostname)) + #+(or lispworks4 lispworks5 lispworks6.0) + (let ((server-addr (fli:allocate-dynamic-foreign-object + :type '(:struct comm::sockaddr_in)))) + (values (comm::initialize-sockaddr_in + server-addr + comm::*socket_af_inet* + hostname + service protocol) + comm::*socket_af_inet* + server-addr + (fli:pointer-element-size server-addr))) + #-(or lispworks4 lispworks5 lispworks6.0) + (progn + (when (stringp hostname) + (setq hostname (comm:string-ip-address hostname)) + (unless hostname + (let ((resolved-hostname (comm:get-host-entry original-hostname :fields '(:address)))) + (unless resolved-hostname + (return-from initialize-dynamic-sockaddr :unknown-host)) + (setq hostname resolved-hostname)))) + (if (or (null hostname) + (integerp hostname) + (comm:ipv6-address-p hostname)) + (let ((server-addr (fli:allocate-dynamic-foreign-object + :type '(:struct comm::lw-sockaddr)))) + (multiple-value-bind (error family) + (comm::initialize-sockaddr_in + server-addr + hostname + service protocol) + (values error family + server-addr + (if (eql family comm::*socket_af_inet*) + (fli:size-of '(:struct comm::sockaddr_in)) + (fli:size-of '(:struct comm::sockaddr_in6)))))) + :bad-host))) + +(defun open-udp-socket (&key local-address local-port read-timeout + (address-family comm::*socket_af_inet*)) "Open a unconnected UDP socket. For binding on address ANY(*), just not set LOCAL-ADDRESS (NIL), for binding on random free unused port, set LOCAL-PORT to 0." @@ -201,59 +241,55 @@ ;; safe and it will be very fast after the first time. #+win32 (comm::ensure-sockets) - (let ((socket-fd (comm::socket comm::*socket_af_inet* *socket_sock_dgram* *socket_ip_proto_udp*))) + (let ((socket-fd (comm::socket address-family *socket_sock_dgram* *socket_ip_proto_udp*))) (if socket-fd - (progn - (when read-timeout (set-socket-receive-timeout socket-fd read-timeout)) - (if local-port - (fli:with-dynamic-foreign-objects ((client-addr (:struct comm::sockaddr_in))) - (comm::initialize-sockaddr_in client-addr comm::*socket_af_inet* - local-address local-port "udp") - (if (comm::bind socket-fd - (fli:copy-pointer client-addr :type '(:struct comm::sockaddr)) - (fli:pointer-element-size client-addr)) - ;; success, return socket fd - socket-fd - (progn - (comm::close-socket socket-fd) - (error "cannot bind")))) + (progn + (when read-timeout (set-socket-receive-timeout socket-fd read-timeout)) + (if local-port + (fli:with-dynamic-foreign-objects () + (multiple-value-bind (error local-address-family + client-addr client-addr-length) + (initialize-dynamic-sockaddr local-address local-port "udp") + (if (or error (not (eql address-family local-address-family))) + (progn + (comm::close-socket socket-fd) + (error "cannot resolve hostname ~S, service ~S: ~A" + local-address local-port (or error "address family mismatch"))) + (if (comm::bind socket-fd client-addr client-addr-length) + ;; success, return socket fd + socket-fd + (progn + (comm::close-socket socket-fd) + (error "cannot bind")))))) socket-fd)) (error "cannot create socket")))) (defun connect-to-udp-server (hostname service - &key local-address local-port read-timeout) + &key local-address local-port read-timeout) "Something like CONNECT-TO-TCP-SERVER" - (let ((socket-fd (open-udp-socket :local-address local-address - :local-port local-port - :read-timeout read-timeout))) - (if socket-fd - (fli:with-dynamic-foreign-objects ((server-addr (:struct comm::sockaddr_in))) - ;; connect to remote address/port - (comm::initialize-sockaddr_in server-addr comm::*socket_af_inet* hostname service "udp") - (if (comm::connect socket-fd - (fli:copy-pointer server-addr :type '(:struct comm::sockaddr)) - (fli:pointer-element-size server-addr)) - ;; success, return socket fd - socket-fd - ;; fail, close socket and return nil - (progn - (comm::close-socket socket-fd) - (error "cannot connect")))) - (error "cannot create socket")))) - -;; Register a special free action for closing datagram usocket when being GCed -(defun usocket-special-free-action (object) - (when (and (typep object 'datagram-usocket) - (%open-p object)) - (socket-close object))) - -(eval-when (:load-toplevel :execute) - (hcl:add-special-free-action 'usocket-special-free-action)) + (fli:with-dynamic-foreign-objects () + (multiple-value-bind (error address-family server-addr server-addr-length) + (initialize-dynamic-sockaddr hostname service "udp") + (when error + (error "cannot resolve hostname ~S, service ~S: ~A" + hostname service error)) + (let ((socket-fd (open-udp-socket :local-address local-address + :local-port local-port + :read-timeout read-timeout + :address-family address-family))) + (if socket-fd + (if (comm::connect socket-fd server-addr server-addr-length) + ;; success, return socket fd + socket-fd + ;; fail, close socket and return nil + (progn + (comm::close-socket socket-fd) + (error "cannot connect"))) + (error "cannot create socket")))))) (defun socket-connect (host port &key (protocol :stream) (element-type 'base-char) timeout deadline (nodelay t nodelay-specified) - local-host (local-port #+win32 *auto-port* #-win32 nil)) - (declare (ignorable nodelay)) + local-host local-port) ;; What's the meaning of this keyword? (when deadline @@ -264,7 +300,8 @@ (unsupported 'timeout 'socket-connect :minimum "LispWorks 4.4.5")) #+(or lispworks4 lispworks5.0) ; < 5.1 - (when nodelay-specified + (when (and nodelay-specified + (not (eq nodelay :if-supported))) (unsupported 'nodelay 'socket-connect :minimum "LispWorks 5.1")) #+lispworks4 #+lispworks4 @@ -390,16 +427,19 @@ "Send message to a socket, using sendto()/send()" (declare (type integer socket-fd) (type sequence buffer)) - (fli:with-dynamic-foreign-objects ((client-addr (:struct comm::sockaddr_in))) - (fli:with-dynamic-lisp-array-pointer (ptr message :type '(:unsigned :byte)) - (replace message buffer :end2 length) - (if (and host service) - (progn - (comm::initialize-sockaddr_in client-addr comm::*socket_af_inet* host service "udp") + (fli:with-dynamic-lisp-array-pointer (ptr message :type '(:unsigned :byte)) + (replace message buffer :end2 length) + (if (and host service) + (fli:with-dynamic-foreign-objects () + (multiple-value-bind (error family client-addr client-addr-length) + (initialize-dynamic-sockaddr host service "udp") + (when error + (error "cannot resolve hostname ~S, service ~S: ~A" + host service error)) (%sendto socket-fd ptr (min length +max-datagram-packet-size+) 0 (fli:copy-pointer client-addr :type '(:struct comm::sockaddr)) - *length-of-sockaddr_in*)) - (comm::%send socket-fd ptr (min length +max-datagram-packet-size+) 0))))) + client-addr-length))) + (comm::%send socket-fd ptr (min length +max-datagram-packet-size+) 0)))) (defmethod socket-send ((socket datagram-usocket) buffer length &key host port) (send-message (socket socket) Modified: usocket/branches/0.5.x/backend/mcl.lisp ============================================================================== --- usocket/branches/0.5.x/backend/mcl.lisp Sat Feb 4 09:48:27 2012 (r686) +++ usocket/branches/0.5.x/backend/mcl.lisp Mon Feb 27 06:49:55 2012 (r687) @@ -73,6 +73,8 @@ (defun socket-connect (host port &key (element-type 'character) timeout deadline nodelay local-host local-port (protocol :stream)) + (when (eq nodelay :if-supported) + (setf nodelay t)) (when (eq protocol :datagram) (unsupported '(protocol :datagram) 'socket-connect)) (with-mapped-conditions () Modified: usocket/branches/0.5.x/backend/openmcl.lisp ============================================================================== --- usocket/branches/0.5.x/backend/openmcl.lisp Sat Feb 4 09:48:27 2012 (r686) +++ usocket/branches/0.5.x/backend/openmcl.lisp Mon Feb 27 06:49:55 2012 (r687) @@ -85,6 +85,8 @@ (defun socket-connect (host port &key (protocol :stream) (element-type 'character) timeout deadline nodelay local-host local-port) + (when (eq nodelay :if-supported) + (setf nodelay t)) (with-mapped-conditions () (ecase protocol (:stream Modified: usocket/branches/0.5.x/backend/sbcl.lisp ============================================================================== --- usocket/branches/0.5.x/backend/sbcl.lisp Sat Feb 4 09:48:27 2012 (r686) +++ usocket/branches/0.5.x/backend/sbcl.lisp Mon Feb 27 06:49:55 2012 (r687) @@ -261,8 +261,11 @@ ;; package today. There's no guarantee the functions ;; we need are available, but we can make sure not to ;; call them if they aren't + (not (eq nodelay :if-supported)) (not sockopt-tcp-nodelay-p)) (unsupported 'nodelay 'socket-connect)) + (when (eq nodelay :if-supported) + (setf nodelay t)) (let ((socket (make-instance 'sb-bsd-sockets:inet-socket :type protocol Modified: usocket/branches/0.5.x/backend/scl.lisp ============================================================================== --- usocket/branches/0.5.x/backend/scl.lisp Sat Feb 4 09:48:27 2012 (r686) +++ usocket/branches/0.5.x/backend/scl.lisp Mon Feb 27 06:49:55 2012 (r687) @@ -34,8 +34,9 @@ (local-port nil local-port-p) &aux (patch-udp-p (fboundp 'ext::inet-socket-send-to))) - (declare (ignore nodelay)) - (when nodelay-specified (unsupported 'nodelay 'socket-connect)) + (when (and nodelay-specified + (not (eq nodelay :if-supported))) + (unsupported 'nodelay 'socket-connect)) (when deadline (unsupported 'deadline 'socket-connect)) (when timeout (unsupported 'timeout 'socket-connect)) (when (and local-host-p (not patch-udp-p)) Modified: usocket/branches/0.5.x/usocket.lisp ============================================================================== --- usocket/branches/0.5.x/usocket.lisp Sat Feb 4 09:48:27 2012 (r686) +++ usocket/branches/0.5.x/usocket.lisp Mon Feb 27 06:49:55 2012 (r687) @@ -529,7 +529,7 @@ ;; Documentation for the function ;; -;; (defun SOCKET-CONNECT (host port &key element-type) ..) +;; (defun SOCKET-CONNECT (host port &key element-type nodelay some-other-keys...) ..) ;; (setf (documentation 'socket-connect 'function) "Connect to `host' on `port'. `host' is assumed to be a string or @@ -539,6 +539,20 @@ `element-type' specifies the element type to use when constructing the stream associated with the socket. The default is 'character. +`nodelay' Allows to disable/enable Nagle's algorithm (http://en.wikipedia.org/wiki/Nagle%27s_algorithm). +If this parameter is omitted, the behaviour is inherited from the +CL implementation (in most cases, Nagle's algorithm is +enabled by default, but for example in ACL it is disabled). +If the parmeter is specified, one of these three values is possible: + T - Disable Nagle's algorithm; signals an UNSUPPORTED + condition if the implementation does not support explicit + manipulation with that option. + NIL - Leave Nagle's algorithm enabled on the socket; + signals an UNSUPPORTED condition if the implementation does + not support explicit manipulation with that option. + :IF-SUPPORTED - Disables Nagle's algorithm if the implementation + allows this, otherwises just ignore this option. + Returns a usocket object.") ;; Documentation for the function From ctian at common-lisp.net Mon Feb 27 14:56:33 2012 From: ctian at common-lisp.net (ctian at common-lisp.net) Date: Mon, 27 Feb 2012 06:56:33 -0800 Subject: [usocket-cvs] r688 - usocket/branches/0.5.x Message-ID: Author: ctian Date: Mon Feb 27 06:56:33 2012 New Revision: 688 Log: Update version info Modified: usocket/branches/0.5.x/usocket.asd Modified: usocket/branches/0.5.x/usocket.asd ============================================================================== --- usocket/branches/0.5.x/usocket.asd Mon Feb 27 06:49:55 2012 (r687) +++ usocket/branches/0.5.x/usocket.asd Mon Feb 27 06:56:33 2012 (r688) @@ -8,7 +8,7 @@ :name "usocket" :author "Erik Enge & Erik Huelsmann" :maintainer "Chun Tian (binghe)" - :version "0.5.1" + :version "0.5.5" :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (#+sbcl :sb-bsd-sockets) From ctian at common-lisp.net Mon Feb 27 14:57:24 2012 From: ctian at common-lisp.net (ctian at common-lisp.net) Date: Mon, 27 Feb 2012 06:57:24 -0800 Subject: [usocket-cvs] r689 - usocket/tags/0.5.5 Message-ID: Author: ctian Date: Mon Feb 27 06:57:23 2012 New Revision: 689 Log: Created tag 0.5.5. Added: usocket/tags/0.5.5/ - copied from r688, usocket/branches/0.5.x/ From ctian at common-lisp.net Mon Feb 27 14:58:42 2012 From: ctian at common-lisp.net (ctian at common-lisp.net) Date: Mon, 27 Feb 2012 06:58:42 -0800 Subject: [usocket-cvs] r690 - public_html/releases Message-ID: Author: ctian Date: Mon Feb 27 06:58:41 2012 New Revision: 690 Log: usocket 0.5.5 Added: public_html/releases/usocket-0.5.5.tar.gz (contents, props changed) public_html/releases/usocket-0.5.5.tar.gz.asc Modified: public_html/releases/usocket-latest.tar.gz public_html/releases/usocket-latest.tar.gz.asc Added: public_html/releases/usocket-0.5.5.tar.gz ============================================================================== Binary file. No diff available. Added: public_html/releases/usocket-0.5.5.tar.gz.asc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ public_html/releases/usocket-0.5.5.tar.gz.asc Mon Feb 27 06:58:41 2012 (r690) @@ -0,0 +1,8 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG/MacGPG2 v2.0.17 (Darwin) +Comment: GPGTools - http://gpgtools.org + +iEYEABECAAYFAk9LmgwACgkQny6v4+l8uLBltQCg5Ji/zxylS+5+I+T7hQvlVUwr +pe4AnA6jm6ZFwjZjB3iaX2lnXpwe2T3G +=Byoy +-----END PGP SIGNATURE----- Modified: public_html/releases/usocket-latest.tar.gz ============================================================================== --- public_html/releases/usocket-latest.tar.gz Mon Feb 27 06:57:23 2012 (r689) +++ public_html/releases/usocket-latest.tar.gz Mon Feb 27 06:58:41 2012 (r690) @@ -1 +1 @@ -link usocket-0.5.4.tar.gz \ No newline at end of file +link usocket-0.5.5.tar.gz \ No newline at end of file Modified: public_html/releases/usocket-latest.tar.gz.asc ============================================================================== --- public_html/releases/usocket-latest.tar.gz.asc Mon Feb 27 06:57:23 2012 (r689) +++ public_html/releases/usocket-latest.tar.gz.asc Mon Feb 27 06:58:41 2012 (r690) @@ -1 +1 @@ -link usocket-0.5.4.tar.gz.asc \ No newline at end of file +link usocket-0.5.5.tar.gz.asc \ No newline at end of file From ctian at common-lisp.net Mon Feb 27 15:10:33 2012 From: ctian at common-lisp.net (ctian at common-lisp.net) Date: Mon, 27 Feb 2012 07:10:33 -0800 Subject: [usocket-cvs] r691 - public_html Message-ID: Author: ctian Date: Mon Feb 27 07:10:32 2012 New Revision: 691 Log: [usocket-web] documentation updates for 0.5.5 Modified: public_html/api-docs.shtml public_html/index.shtml Modified: public_html/api-docs.shtml ============================================================================== --- public_html/api-docs.shtml Mon Feb 27 06:58:41 2012 (r690) +++ public_html/api-docs.shtml Mon Feb 27 07:10:32 2012 (r691) @@ -1,11 +1,11 @@ - + - - USOCKET API documentation - - - - - - -

USOCKET API documentation

-

$Id$
-Work in progress.

-

Please note that we're committed to the interface described -below for the entire 0.x phase of the library. When 1.0 comes -some of the functionality may be split up in different functions -and guarantees may change because of it.

-

Conventions

-
-
Specification of a host or local-host -parameter
-
A host or local-host parameter may be any one -of + +
    -
  • 32-bit positive integer,
  • -
  • A four element integer list representing IPv4 address, i.e. -#(127 0 0 1)
    -
  • -
  • a string containing an IP addres in dotted notation, or
  • -
  • a host name to be resolved through DNS lookup.
  • +
  • API documentation
  • +
  • How do I ... (FAQ)
-
-
-

Functions for socket creation and manipulation

-
-
socket-connect -host port &key protocol element-type timeout deadline nodelay -local-host local-port => socket
-
-

Creates a TCP (stream) or UDP (datagram) socket to the host -and port specified. The return value is -a socket object of class stream-usocket, -or - datagram-usocket.

-

protocol should be :stream (default) or :datagram, -which -means -TCP -or -UDP (Start from USOCKET 0.5)
- element-type argument is used in the -construction of the associated stream, i.e. 'character or - '(unsigned-byte 8), only used by TCP.
- timeout is a integer, it represents the socket option SO_RCVTIMEO -(read timeout), in seconds.
- deadline is only supported in Clozure CL and Digitool MCL, -look up their documents please.
- local-host and local-port, when specified, will -cause the socket calling bind() on local address. This is useful for -selecting interfaces to send, or listening on UDP port. Note: use only -one of them are allowed when reasonable (listen on wildcard address, or -bind to random free port).
-
-

-
-
socket-listen -host port &key reuse-address backlog element-type => socket
-
-

Creates and returns a passive ("server") socket associated with host -and port. The object returned is of subtype stream-server-usocket.

-

host names a local interface.
- port names a local port, or 0 (zero) to request a random -free port.
- reuse-address is a boolean (t, nil) value signalling reuse -of the address is requested (or not).
- backlog is the length of the queue containing connections -which haven't actually been accepted yet.
- element-type is the default element type used for sockets -created by socket-accept. character is the default when it's -not explicitly provided.

-
-
socket-accept -socket &key element-type => new-socket
-
-

Creates and returns an active ("connected") stream socket new-socket -from the socket passed. The return value is a socket object -of class stream-usocket.

-

element-type is the element type used to construct the -associated stream. If it's not specified, the element-type of socket -(as used when it was created by the call to socket-listen) is used.

-
-
socket-close -socket
-
-

Flushes the stream associated with the socket and closes the -socket connection.

-
-
get-local-name -socket => address, port
- get-local-address -socket => address
- get-local-port -socket => port
-
-

Returns the local address and/or port information of socket.

-
-
get-peer-name -socket => address, port
- get-peer-address -socket => address
- get-peer-port -socket => port
-
-

Returns the remote address and/or port information of socket. -The socket passed to this function must be a connected socket.

-
-
socket-send -socket buffer length &key host port
-
-
-

Send a (unsigned-byte 8) data buffer to a datagram socket, and -return the number of bytes sent. (Start from USOCKET 0.5)

-

socket should be a datagram-usocket.
- buffer is a Lisp vector, type of (simple-array -(unsigned-byte 8) *).
- length is used to tell socket-send -the actual useful length of data buffer for sending to socket.
- host and port are used for unconnected datagram -sockets, for sending to specific destination.
-

-
-
socket-receive -socket buffer length
-
-
-

Receive data from a datagram socket, and return 4 values: return-buffer, - - - - - return-length, remote-host, and remove-port. -If -the -datagram -socket -was -created -by - - - - socket-connect -with a timeout keyword argument, this function will block at -most that timeout value (in seconds). (Start from USOCKET 0.5)

-

socket should be a datagram-usocket.
- buffer is a Lisp vector, type of (simple-array -(unsigned-byte 8) *). Using nil here is also -allowed, new buffer will be created to hold data.
- length is used to specify the length of a exist buffer for -receiving at most these data. Using nil here is allowed, and -the actual length of buffer will be used; when buffer -is also nil, a default maximum length (65507) will be -used.
-

-
-
wait-for-input -socket-or-sockets &key timeout ready-only
-
-
-

Waiting on one or multiple sockets for given time, and returns -once some of them are available of reading data. This is like UNIX's -"select" function.
-
-It returns two values: the first is the list of sockets which are -readable (or in case of server sockets acceptable). nil may be returned -for this value either when waiting timed out or when it was interrupted -(EINTR).  The second value is a real number indicating the time -remaining within the timeout period or nil if none.
-
-Without the ready-only argument, WAIT-FOR-INPUT will return -all sockets in -the original list you passed it. This prevents a new list from being -consed up. Some users of USOCKET were reluctant to use it if it -wouldn't behave that way, expecting it to cost significant performance -to do the associated garbage collection.
-
-Without the ready-only arg, you need to check the socket -STATE slot for -the values documented in usocket class.
-

-
-
socket-server -host port function &optional arguments &key in-new-thread -protocol timeout max-buffer-size element-type reuse-address -multi-threading
-
-
-

Create a simple TCP or UDP socket server. (Start from USOCKET -0.5)
-

-

host names a local interface,
- port names a local port,
- function names a function object, which is used to handle -TCP or UDP connections, the actual API of this function will be -explained later.
- arguments is a list used for passing extra arguments to -user-defined function.
- in-new-thread is a boolean, default is nil. -When it's T, the server will be created in a new thread -and socket-server returns immediately in current thread.
- protocol could be either :stream (default) -or :datagram, which decide the socket server is TCP -server or UDP server.
- timeout is UDP only, it provides the internal socket-receive call (in UDP event -loop of the socket server) a read timeout, default value is 1 (second).
- max-buffer-size is UDP only, it's the max UDP data buffer -size when handling UDP packets, default value is 65507.
- element-type is TCP only, it's element-type of the stream -provided for user-defined function,
- reuse-address is TCP only, it's a boolean option for -internal call of socket-listen in the socket server,
- multi-threading is TCP only, it's a boolean, default value -is nil. When it's T, each client connection -will cause a new thread being created to handle that client, so that -the TCP server could handle multiple clients at the same time. (Note: -since UDP server is connectionless, it can always handle multiple -clients, as long as the handler function run fast enough)
-

-

The handler function for TCP is stream-based. A template -function -is this one:

-
(defun default-tcp-handler (stream) ; null
(declare (type stream stream))
(terpri stream))
-

Note: 1. you don't need to close the stream as socket-server -will do that for you. -2. More function arguments can be defined, and these extra arguments -must be feeded as the optional arguments of socket-server.

-

The handler function for UDP is buffer-based, that is, -you receive a buffer of data as input, and you return another buffer -for output. A template function is a simple UDP echo server:

-
(defun default-udp-handler (buffer) ; echo
(declare (type (simple-array (unsigned-byte 8) *) buffer))
buffer)
-

Note: 1. data length is the length of the whole buffer. 2. -Sometimes you may want to know the client's IP address and sending -port, these informations are specially bounded on variables - *remote-host* and *remote-port* when handler function -is running.

-
-
-

Classes

-
-
usocket
-
Slots: +

USOCKET API documentation

+

$Id: api-docs.shtml 558 2010-09-15 + 03:35:27Z ctian $
+ Work in progress.

+

Please note that we're committed to the interface described + below for the entire 0.x phase of the library. When 1.0 comes + some of the functionality may be split up in different functions + and guarantees may change because of it.

+

Conventions

+
+
Specification of a host or local-host + parameter
+
A host or local-host parameter may be any + one + of +
    +
  • 32-bit positive integer,
  • +
  • A four element integer list representing IPv4 address, + i.e. + #(127 0 0 1)
    +
  • +
  • a string containing an IP addres in dotted notation, or
  • +
  • a host name to be resolved through DNS lookup.
  • +
+
+
+

Functions for socket creation and manipulation

-
socket :accessor socket
+
socket-connect + host port &key protocol element-type timeout deadline + nodelay + local-host local-port => socket
+
+

Creates a TCP (stream) or UDP (datagram) socket to the host + and port specified. The return value is + a socket object of class stream-usocket, + or datagram-usocket.

+

protocol should be :stream (default) + or :datagram, + which + means + TCP + or + UDP (Start from USOCKET 0.5)
+ element-type argument is used in the + construction of the associated stream, i.e. 'character + or '(unsigned-byte 8), only used by TCP.
+ timeout is a integer, it represents the socket option + SO_RCVTIMEO + (read timeout), in seconds.
+ deadline is only supported in Clozure CL and Digitool + MCL, + look up their documents please.
+ local-host and local-port, when specified, + will + cause the socket calling bind() on local address. This is + useful for + selecting interfaces to send, or listening on UDP port. Note: + use only + one of them are allowed when reasonable (listen on wildcard + address, or + bind to random free port).
+

+
+
+

nodelay Allows to disable/enable Nagle's algorithm + (http://en.wikipedia.org/wiki/Nagle%27s_algorithm).
+ If this parameter is omitted, the behaviour is inherited from + the CL implementation (in most cases, Nagle's algorithm is + enabled by default, but for example in ACL it is disabled).
+ If the parmeter is specified, one of these three values is + possible:
+

+
    +
  • T - Disable + Nagle's algorithm; signals an UNSUPPORTED condition if the + implementation does not support explicit manipulation with + that option.
  • +
  • NIL - Leave + Nagle's algorithm enabled on the socket; signals an + UNSUPPORTED condition if the implementation does not support + explicit manipulation with that option.
  • +
  • :IF-SUPPORTED - + Disables Nagle's algorithm if the implementation allow this, + otherwises just ignore this option.
  • +
+
+
+
socket-listen + host port &key reuse-address backlog element-type => + socket
+
+

Creates and returns a passive ("server") socket associated + with host + and port. The object returned is of subtype stream-server-usocket.

+

host names a local interface.
+ port names a local port, or 0 (zero) to request a + random + free port.
+ reuse-address is a boolean (t, nil) value signalling + reuse + of the address is requested (or not).
+ backlog is the length of the queue containing + connections + which haven't actually been accepted yet.
+ element-type is the default element type used for + sockets + created by socket-accept. character is the default + when it's + not explicitly provided.

+
+
socket-accept + socket &key element-type => new-socket
+
+

Creates and returns an active ("connected") stream socket new-socket + from the socket passed. The return value is a socket + object + of class stream-usocket.

+

element-type is the element type used to construct + the + associated stream. If it's not specified, the element-type of + socket + (as used when it was created by the call to socket-listen) is + used.

+
+
socket-close + socket
+
+

Flushes the stream associated with the socket and closes the + socket connection.

+
+
get-local-name + socket => address, port
+ get-local-address + socket => address
+ get-local-port + socket => port
+
+

Returns the local address and/or port information of socket.

+
+
get-peer-name + socket => address, port
+ get-peer-address + socket => address
+ get-peer-port + socket => port
+
+

Returns the remote address and/or port information of socket. + The socket passed to this function must be a connected + socket.

+
+
socket-send + socket buffer length &key host port
-

Used to store sockets as used by the current implementation -- may be any of socket handles, socket objects and stream objects

+

Send a (unsigned-byte 8) data buffer to a datagram socket, + and + return the number of bytes sent. (Start from USOCKET 0.5)

+

socket should be a datagram-usocket.
+ buffer is a Lisp vector, type of (simple-array + (unsigned-byte 8) *).
+ length is used to tell socket-send + the actual useful length of data buffer for sending to socket.
+ host and port are used for unconnected + datagram + sockets, for sending to specific destination.
+

-
state :accessor state
+
socket-receive + socket buffer length
-

Used to store socket state: NIL (not ready), :READ (ready to -read).
+

Receive data from a datagram socket, and return 4 values: return-buffer, + return-length, remote-host, and remove-port. + If + the + datagram + socket + was + created + by socket-connect + with a timeout keyword argument, this function will + block at + most that timeout value (in seconds). (Start from USOCKET 0.5) +

+

socket should be a datagram-usocket.
+ buffer is a Lisp vector, type of (simple-array + (unsigned-byte 8) *). Using nil here is + also + allowed, new buffer will be created to hold data.
+ length is used to specify the length of a exist + buffer for + receiving at most these data. Using nil here is + allowed, and + the actual length of buffer will be used; when buffer + is also nil, a default maximum length (65507) + will be + used.

-
-
-
stream-usocket
-
Parent classes: usocket
-Slots: -
-
stream :accessor socket-stream
+
wait-for-input + socket-or-sockets &key timeout ready-only
+
-

Used to store the stream associated with the tcp socket -connection.
-When you want to write to the socket stream, use this function.

+

Waiting on one or multiple sockets for given time, and + returns + once some of them are available of reading data. This is like + UNIX's + "select" function.
+
+ It returns two values: the first is the list of sockets which + are + readable (or in case of server sockets acceptable). nil may be + returned + for this value either when waiting timed out or when it was + interrupted + (EINTR).  The second value is a real number indicating + the time + remaining within the timeout period or nil if none.
+
+ Without the ready-only argument, WAIT-FOR-INPUT will + return + all sockets in + the original list you passed it. This prevents a new list from + being + consed up. Some users of USOCKET were reluctant to use it if + it + wouldn't behave that way, expecting it to cost significant + performance + to do the associated garbage collection.
+
+ Without the ready-only arg, you need to check the + socket + STATE slot for + the values documented in usocket + class.
+

+
+
socket-server + host port function &optional arguments &key + in-new-thread + protocol timeout max-buffer-size element-type reuse-address + multi-threading
+
+
+

Create a simple TCP or UDP socket server. (Start from USOCKET + 0.5)
+

+

host names a local interface,
+ port names a local port,
+ function names a function object, which is used to + handle + TCP or UDP connections, the actual API of this function will + be + explained later.
+ arguments is a list used for passing extra arguments + to + user-defined function.
+ in-new-thread is a boolean, default is nil. + When it's T, the server will be created in a new + thread + and socket-server returns immediately in current thread.
+ protocol could be either :stream + (default) + or :datagram, which decide the socket server is + TCP + server or UDP server.
+ timeout is UDP only, it provides the internal socket-receive call (in + UDP event + loop of the socket server) a read timeout, default value is 1 + (second).
+ max-buffer-size is UDP only, it's the max UDP data + buffer + size when handling UDP packets, default value is 65507.
+ element-type is TCP only, it's element-type of the + stream + provided for user-defined function,
+ reuse-address is TCP only, it's a boolean option for + internal call of socket-listen in the socket server,
+ multi-threading is TCP only, it's a boolean, default + value + is nil. When it's T, each client + connection + will cause a new thread being created to handle that client, + so that + the TCP server could handle multiple clients at the same time. + (Note: + since UDP server is connectionless, it can always handle + multiple + clients, as long as the handler function run fast enough)
+

+

The handler function for TCP is stream-based. A template + function + is this one:

+
(defun default-tcp-handler (stream) ; null
(declare (type stream stream))
(terpri stream))
+

Note: 1. you don't need to close the stream as socket-server + will do that for you. + 2. More function arguments can be defined, and these extra + arguments + must be feeded as the optional arguments of socket-server.

+

The handler function for UDP is buffer-based, that is, + you receive a buffer of data as input, and you return another + buffer + for output. A template function is a simple UDP echo server:

+
(defun default-udp-handler (buffer) ; echo
(declare (type (simple-array (unsigned-byte 8) *) buffer))
buffer)
+

Note: 1. data length is the length of the whole buffer. 2. + Sometimes you may want to know the client's IP address and + sending + port, these informations are specially bounded on variables *remote-host* and *remote-port* when handler + function + is running.

-
-
stream-server-usocket
-
Parent classes: usocket
-Slots: +

Classes

-
element-type :reader -element-type
-
-

Indicates the default element-type to be used when -constructing streams off this socket when no element type is specified -in the call to socket-accept.

+
usocket
+
Slots: +
+
socket :accessor socket
+
+
+

Used to store sockets as used by the current + implementation + - may be any of socket handles, socket objects and stream + objects

+
+
state :accessor state
+
+
+

Used to store socket state: NIL (not ready), :READ (ready + to + read).
+

+
+
+
+
stream-usocket
+
Parent classes: usocket
+ Slots: +
+
stream :accessor + socket-stream
+
+

Used to store the stream associated with the tcp socket + connection.
+ When you want to write to the socket stream, use this + function.

+
+
+
+
stream-server-usocket
+
Parent classes: usocket
+ Slots: +
+
element-type :reader + element-type
+
+

Indicates the default element-type to be used when + constructing streams off this socket when no element type + is specified + in the call to socket-accept.

+
+
+
+
datagram-usocket + (Start + from + USOCKET + 0.5)
+
+
Parent classes: usocket
+ Slots: +
+
connected-p :accessor + connected-p
+
+

Used to identify if the datagram is connected. It will be + setup by socket-connect, + and + used by socket-send + and socket-receive.

+
+
-
-
datagram-usocket -(Start -from -USOCKET -0.5)
-
-
Parent classes: usocket
-Slots: +

Variables / constants

-
connected-p :accessor -connected-p
+
*wildcard-host*
-

Used to identify if the datagram is connected. It will be -setup by socket-connect, and -used by socket-send and socket-receive.

+

The host to use with socket-listen + to make the socket listen on all available interfaces.

-
-
-
-

Variables / constants

-
-
*wildcard-host*
-
-

The host to use with socket-listen -to make the socket listen on all available interfaces.

-
-
*auto-port*
-
-

The port number to use with socket-listen to make the socket -listen on a random available port. The port number assigned can be -retrieved from the returned socket by calling get-local-port.

-
-
*remote-host*
-
-

Special variable used in socket-server's +

*auto-port*
+
+

The port number to use with socket-listen to make the socket + listen on a random available port. The port number assigned + can be + retrieved from the returned socket by calling get-local-port.

+
+
*remote-host*
+
+

Special variable used in socket-server's handler function for getting current client -address. (Start from -USOCKET 0.5)
-

-
-
*remote-port*
-
-

Special variable used in socket-server's +address. + (Start from + USOCKET 0.5)
+

+
+
*remote-port*
+
+

Special variable used in socket-server's handler function for getting current client -port. (Start from USOCKET -0.5)

-
-
-

How do I ...

-
-
... force the output to be written to the network?
-
When you write output to the stream, it may be buffered before -sent over the network - for optimal performance of small writes. You -can force the buffer to be flushed the same way as with normal streams: -
(format (socket-stream socket) "Hello there~%")   ;; output into buffers
(force-output (socket-stream socket)) ;; <== flush the buffers, if any
-
-
... check whether the other end has closed my socket stream?
-
Reading from a stream which has been closed at the remote end -signals an END-OF-FILE condition, meaning that reading from the stream -and detecting that condition is the way to do it.
-
... check whether reading from a socket stream will block?
-
When you want to check one stream for readiness of input, -call the listen -function on the stream object associated with the socket.
-Example: -
(listen (usocket:socket-stream your-socket))
==> NIL (if no input is available)
-
-
... wait for input to become available on (at least) one stream -(of a set)
-
Currently, that's hard to do efficiently if you want to use -releases. The next minor release (0.4.0) will include this -functionality and for all platforms (except SBCL and LispWorks; both -Win32) it's already available in trunk -(svn://common-lisp.net/project/usocket/svn/usocket/trunk).
-If you want to use this code you're most welcome and feedback is -appreciated.
-Example to be used with trunk: -
(usocket:wait-for-input (list socket1 socket2 socket3) :timeout <your optional timeout value>)
==> list-of-sockets-to-read-from
-
-
... convert my existing trivial-sockets based application to -usocket?
-
There are actually 3 answers to that question. -
    -
  1. Rewrite your code to keep a usocket object instead of the -stream object returned by trivial-sockets.
  2. -
  3. The quick conversion with the good performance -characteristics (use only when you don't want to use the socket object):
    -Replace all your invocations of -
      (trivial-sockets:open-socket-stream ....)

    with
    (usocket:socket-stream (usocket:socket-connect ...))
    -And replace all invocations of -
      (trivial-sockets:socket-accept ...)

    with
    (usocket:socket-stream (usocket:socket-accept ...))
    -And replace all invocations of -
      (trivial-sockets:open-server ...)

    with
    (usocket:socket-listen ...)
    -
  4. -
  5. And the last option which provides a compatible (but slower, -because it uses Gray streams) interface is to use trivial-usocket.
    -The trivial-usocket package provides a 1-1 mapped interface to -trivial-sockets, but uses Gray streams; that way, it's later possible -to retrieve the socket object from the stream returned and to use that -socket for other usocket operations. Use this approach as a migration -path where you're not rewriting your application at once, but in small -steps.
  6. -
-
-
-
-Back to Common-lisp.net. -
- - +port. + (Start from USOCKET + 0.5)

+ + +

How do I ...

+
+
... force the output to be written to the network?
+
When you write output to the stream, it may be buffered before + sent over the network - for optimal performance of small writes. + You + can force the buffer to be flushed the same way as with normal + streams: +
(format (socket-stream socket) "Hello there~%")   ;; output into buffers
(force-output (socket-stream socket)) ;; <== flush the buffers, if any
+
+
... check whether the other end has closed my socket stream?
+
Reading from a stream which has been closed at the remote end + signals an END-OF-FILE condition, meaning that reading from the + stream + and detecting that condition is the way to do it.
+
... check whether reading from a socket stream will block?
+
When you want to check one stream for readiness of + input, + call the listen + function on the stream object associated with the socket.
+ Example: +
(listen (usocket:socket-stream your-socket))
==> NIL (if no input is available)
+
+
... wait for input to become available on (at least) one + stream + (of a set)
+
Currently, that's hard to do efficiently if you want to use + releases. The next minor release (0.4.0) will include this + functionality and for all platforms (except SBCL and LispWorks; + both + Win32) it's already available in trunk + (svn://common-lisp.net/project/usocket/svn/usocket/trunk).
+ If you want to use this code you're most welcome and feedback is + appreciated.
+ Example to be used with trunk: +
(usocket:wait-for-input (list socket1 socket2 socket3) :timeout <your optional timeout value>)
==> list-of-sockets-to-read-from
+
+
... convert my existing trivial-sockets based application to + usocket?
+
There are actually 3 answers to that question. +
    +
  1. Rewrite your code to keep a usocket object instead of the + stream object returned by trivial-sockets.
  2. +
  3. The quick conversion with the good performance + characteristics (use only when you don't want to use the + socket object):
    + Replace all your invocations of +
      (trivial-sockets:open-socket-stream ....)

    with
    (usocket:socket-stream (usocket:socket-connect ...))
    + And replace all invocations of +
      (trivial-sockets:socket-accept ...)

    with
    (usocket:socket-stream (usocket:socket-accept ...))
    + And replace all invocations of +
      (trivial-sockets:open-server ...)

    with
    (usocket:socket-listen ...)
    +
  4. +
  5. And the last option which provides a compatible (but + slower, + because it uses Gray streams) interface is to use + trivial-usocket.
    + The trivial-usocket package provides a 1-1 mapped interface + to + trivial-sockets, but uses Gray streams; that way, it's later + possible + to retrieve the socket object from the stream returned and + to use that + socket for other usocket operations. Use this approach as a + migration + path where you're not rewriting your application at once, + but in small + steps.
  6. +
+
+
+
+ Back to Common-lisp.net. +
+ + Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml Mon Feb 27 06:58:41 2012 (r690) +++ public_html/index.shtml Mon Feb 27 07:10:32 2012 (r691) @@ -23,42 +23,34 @@

Goal

The project wants to provide a portable TCP/IP and UDP/IP socket - interface for as many Common Lisp implementations as - possible, while keeping the abstraction and portability layer as - thin - as possible.

+ interface for as many Common Lisp implementations as possible, + while keeping the abstraction and portability layer as thin as + possible.

Because trivial-sockets has been declared dead and its author has said he will declare - usocket - its successor if there is a zero effort path of migration, I'm also -working -on - trivial-usocket which is supposed to be a - sub-optimal, - but zero - effort migration from trivial-sockets.

+ usocket its successor if there is a zero effort path of migration, + I'm also + working + on trivial-usocket which is supposed to be a + sub-optimal, but zero effort migration from trivial-sockets.

If your lisp isn't mentioned in the list below, please feel free - to - submit a request for it at the mailing list mentioned below.

+ to submit a request for it at the mailing list mentioned below.

Comparison to other socket libraries

Since usocket is effectively the succesor to trivial-sockets, see the feature comparison - with - trivial-sockets in order to find out which one you should use.

+ with trivial-sockets in order to find out which one you should + use.

After starting the project, many others turned out to have worked - on - something alike, many times as part of a broader project or - library. - Some of them were known at the start of this project, others have - been - conceived after the usocket project already started. Not all of - them - have exactly the same portability goal.

+ on something alike, many times as part of a broader project or + library. Some of them were known at the start of this project, + others have been conceived after the usocket project already + started. Not all of them have exactly the same portability goal.

See the Implementation comparison page for a comparison of the portability of other libaries and how that relates to usocket.

Documentation

See the documentation page for the API + description.

Supported implementations

Currently these implementations are supported:

@@ -82,58 +74,49 @@

Community

This project has started Januari 2006. There isn't much of a community yet, though I'd like there to be one. So, you're invited - to - join the mailing list, announce yourself and even join the effort! -

+ to join the mailing list, announce yourself and even join the + effort!

Development discussion takes place on usocket-devel at common-lisp.net.

Project tracking happens in the project's Trac setup. Please take note of the guidelines before entering a bug or - enhancement - request into the database.

+ enhancement request into the database.

Development

Development will at least follow the steps outlined below. Yet - to be - determined is whether the currently mentioned steps will be - enough to - release version 1.0. Possibly, UDP sockets remain to be - addressed - before doing 1.0; that will depend on your reactions :-)

+ to be determined is whether the currently mentioned steps will + be enough to release version 1.0. Possibly, UDP sockets remain + to be addressed before doing 1.0; that will depend on your + reactions :-)

The targeted implementations listed in the status table below - are - not a final list: others can be added if/when the need or - interest - arrises.

+ are not a final list: others can be added if/when the need or + interest arrises.

Active + development is taking place in the Subversion - repository. To be - kept up to date, please subscribe to the commit message mailing - list. To use the latest development - version, make sure you have Subversion + + list. To use the latest development version, make sure you + have Subversion installed and execute this command:

 $ svn checkout svn://common-lisp.net/project/usocket/svn/usocket/trunk usocket-svn

Please send patches, bug reports and suggestions to the - development - mailing list address given above. The table below indicates the - current - state of development.

+ development mailing list address given above. The table below + indicates the current state of development.

@@ -157,6 +140,7 @@ +
+ + interfaces provided. @@ -247,8 +231,8 @@ Local and remote IP address and port. + + interfaces provided @@ -329,12 +313,11 @@ + sockets in one function call (select() like behaviour). + + interfaces provided @@ -391,8 +374,8 @@ + + API's provided @@ -437,6 +420,25 @@ + + + + + + + + + + + for WAIT-FOR-INPUT for SBCL and ECL on Win32; new platform + added: Macintosh Common Lisp (5.0 and up) @@ -507,17 +505,14 @@ + would return NIL instead of erroring. + LispWorks fix for broken server sockets. API guarantee + adjustments in preparation of porting Drakma. @@ -529,8 +524,8 @@ + because the originals included Subversion administration + areas. @@ -551,8 +546,8 @@ + flexi-streams on socket streams for portable + :external-format support. @@ -570,11 +565,10 @@ + Common Lisp, fix issue + #6 and API preparation for server side sockets (not in + this release) @@ -586,17 +580,12 @@

Project history

Long ago the project was conceived and started by Erik Enge in an attempt to factor out all implementation specific sockets code - from - cl-irc. This 'long ago' must have - been - way before 2003 when I entered the cl-irc project.

+ from cl-irc. This 'long ago' must + have been way before 2003 when I entered the cl-irc project.

In january 2006, Erik Huelsmann found Erik Enge willing to donate the code he had still laying around to restart the project. The - restart - took place at the 27th of january when the old code was imported - into - the - public repository.
+ restart took place at the 27th of january when the old code was + imported into the public repository.

Starting from 2008, Chun Tian (binghe) joined into usocket development team with his UDP code base.
@@ -604,11 +593,10 @@


Back to - Common-lisp.net. -
+ + Common-lisp.net. + Strict
Status for - the - currently targeted backends
Major steps Socket implementations
Minimal active sockets support at the same - level - as provided by trivial-sockets.
+ level as provided by trivial-sockets.
(Meaning streamed tcp traffic on connected sockets.)
Investigate - interfaces - provided. DONE DONE DONE Investigate - interfaces - provided DONE DONE DONE
Implement efficient waiting for multiple - sockets - in one function call (select() like behaviour). Investigate - interfaces - provided DONE DONE DONEImplement udp socket support. Investigate - API's - provided DONE DONE DONESummary
Feb 27, 2012
+
0.5.5
+
LispWorks 6.1 compatibility; + SOCKET-CONNECT argument :nodelay can now set to + :if-supported
+
Oct 1, 2011
+
0.5.4
+
Minor fixes for ECL, Allegro + CL modern mode, and SBCL.
+
Aug 13, 2011
0.5.3
@@ -462,20 +464,16 @@
0.5.1
Improved - CLISP support using FFI; Lots of bugfix for CMUCL, - SBCL, - LispWorks, etc.
+ bold;">Improved CLISP support using FFI; Lots of + bugfix for CMUCL, SBCL, LispWorks, etc.
Mar 12, 2011 0.5.0 UDP support; Lots of bugfixes since 0.4.1; support - for - WAIT-FOR-INPUT for SBCL and ECL on Win32; new platform - added: Macintosh - Common Lisp (5.0 and up)
Dec 27, 2008Jun 05, 2007 0.3.3 Fix where host resolution routine was unable to resolve - would - return NIL instead of erroring.
Mar 04, 2007 0.3.2 Fixes for many backends related to closing sockets. - LispWorks - fix for broken server sockets. API guarantee adjustments in - preparation - of porting Drakma.
Feb 28, 2007Feb 26, 2007 re-release Re-release of 0.2.3, 0.2.4, 0.2.5 and 0.3.0 tarballs - because - the originals included Subversion administration areas.
Jan 21, 2007Jan 04, 2007 0.2.3 Add :element-type support to support stacking - flexi-streams - on socket streams for portable :external-format support.
Jan 03, 20070.2.0 Add support for Scieneer - Common Lisp, - fix issue - #6 - and API preparation for server side sockets (not in this - release)
Feb 13, 2006