Somebody wrote: > | Succeeds: > | (connect-to-inet-socket "10.0.0.1" 25) > | > | Fails: > | (defparameter *ip* (car (ext:host-entry-addr-list > | (ext:lookup-host-entry "10.0.0.1")))) > | (connect-to-inet-socket *ip* 25) > | > > This seems more a result of how the underlying OS functions work. > gethostbyname will work on the "10.0.0.1" form but gethostbyaddr > relies on the reverse DNS or some local alias > scheme. Lookup-host-entry depends on those functions to do its > job. One hopes the OS network layer has more knowledge about network > implementations than application code. There's simply no reason to call gethostbyaddr. I finally fought past some trouble converting the cmucl-source deb with alien, at least enough to look at the source. Here is a new version of connect-to-inet-socket that won't leak file descriptors and has no ipaddr bugs: (defun connect-to-inet-socket (host port &optional (kind :stream)) "The host may be an address string or an IP address in host order." (let ((addr (if (stringp host) (host-entry-addr (or (lookup-host-entry host) (error "Unknown host: ~S." host))) host)) (socket (create-inet-socket kind))) (with-alien ((sockaddr inet-sockaddr)) (setf (slot sockaddr 'family) af-inet) (setf (slot sockaddr 'port) (htons port)) (setf (slot sockaddr 'addr) (htonl addr)) (when (minusp (unix:unix-connect socket (alien-sap sockaddr) (alien-size inet-sockaddr :bytes))) (unix:unix-close socket) (error "Error connecting socket to [~A:~A]: ~A" (if (stringp host) host (let ((naddr (htonl addr))) (format nil "~D.~D.~D.~D" (ldb (byte 8 0) naddr) (ldb (byte 8 8) naddr) (ldb (byte 8 16) naddr) (ldb (byte 8 24) naddr)))) port (unix:get-unix-error-msg))) socket))) (Thanks to Pierre Mai for his help, too.) Thanks, John Wiseman