X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-bsd-sockets%2Finet.lisp;h=869b80f93c83877c11421d9e5ea3f13777c63afd;hb=2db542f484283726e64dd4606e7a0f74b9b228ee;hp=57ab02c87c08669ee1eecf643e98ca7a45bb72da;hpb=db770d287bb64a58967d08fdd8225c02cdd4d45a;p=sbcl.git diff --git a/contrib/sb-bsd-sockets/inet.lisp b/contrib/sb-bsd-sockets/inet.lisp index 57ab02c..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.