On 9/14/07, Chandler Escude chandler@reduct-intact.org wrote:
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.
Yes, CLISP in general was affected. Thanks for the report. I released usocked-0.3.5 with this fix (and several others) applied.
bye,
Erik.