[usocket-devel] get-peer-name/get-local-name IP quad error in CLISP

Chandler Escude chandler at reduct-intact.org
Fri Sep 14 11:51:34 UTC 2007


All,

I received an error when trying to call `get-peer-name' on a connected  
socket (`dotted-quad-to-vector-quad' was trying to parse a hostname as an  
IP).  The problem is that `get-peer-name' expects CLISP's  
`socket:socket-stream-peer' function to always return a dotted-quad; by  
default, however, `socket:socket-stream-peer' will attempt hostname  
resolution on the peer address  
(http://clisp.cons.org/impnotes/socket.html#sost-peer).

Fortunately, the second argument (`do-not-resolve-p') is used to suppress  
this lookup, so the fix should be as simple as changing the `nil' below to  
`t':

(defmethod get-peer-name ((usocket stream-usocket))
   (multiple-value-bind
       (address port)
       (socket:socket-stream-peer (socket usocket) nil)
     (values (dotted-quad-to-vector-quad address) port)))

I didn't try it out, but `get-local-name' looks to suffer from the same  
issue:

(defmethod get-local-name ((usocket usocket))
   (multiple-value-bind
       (address port)
       (socket:socket-stream-local (socket usocket) nil)
     (values (dotted-quad-to-vector-quad address) port)))

Although I noticed the error using Windows XP at work, it looks to affect  
CLISP in general.

-- Chandler



More information about the usocket-devel mailing list