X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-bsd-sockets%2Finet.lisp;h=869b80f93c83877c11421d9e5ea3f13777c63afd;hb=7c75cd363da90afe334e936aad2b63437ea5905d;hp=716095cf5794eb425dbcbc70576474a435e06273;hpb=a539be5d6c2ba4a6a68d761a6bcce977f9de2b19;p=sbcl.git diff --git a/contrib/sb-bsd-sockets/inet.lisp b/contrib/sb-bsd-sockets/inet.lisp index 716095c..869b80f 100644 --- a/contrib/sb-bsd-sockets/inet.lisp +++ b/contrib/sb-bsd-sockets/inet.lisp @@ -17,6 +17,16 @@ Examples: ;;; XXX should we *...* this? (defparameter inet-address-any (vector 0 0 0 0)) +(defmethod socket-namestring ((socket inet-socket)) + (ignore-errors + (multiple-value-bind (addr port) (socket-name socket) + (format nil "~{~A~^.~}:~A" (coerce addr 'list) port)))) + +(defmethod socket-peerstring ((socket inet-socket)) + (ignore-errors + (multiple-value-bind (addr port) (socket-peername socket) + (format nil "~{~A~^.~}:~A" (coerce addr 'list) port)))) + ;;; binding a socket to an address and port. Doubt that anyone's ;;; actually using this much, to be honest. @@ -25,7 +35,7 @@ Examples: \"127.0.0.1\". Signals an error if the string is malformed." (declare (type string dotted-quads)) (labels ((oops () - (error "~S is not a string designating an IP address." + (error "~S is not a string designating an IP address." dotted-quads)) (check (x) (if (typep x '(unsigned-byte 8))