;;; Silly little example of using sockets in ACL. See whois(1) ;;; on your local Unix box for additional information. ;;; by R. Matthew Emerson , October 1999 (eval-when (:compile-toplevel :load-toplevel) (require :socket) (use-package :socket)) (in-package :cl-user) (defconstant *whois-port* 43) (defun whois (what &optional (server "whois.internic.net")) (let ((port (ignore-errors (lookup-port "whois" "tcp")))) (if (null port) (setf port *whois-port*)) (with-open-stream (s (make-socket :remote-host server :remote-port port)) (format s "~a~c~c" what #\return #\linefeed) (force-output s) (do ((line (read-line s nil :eof) (read-line s nil :eof))) ((eq line :eof)) (princ line) (terpri))))) ;;; some examples #| (whois "me67") ;look up yours truly (whois "franz.com") (whois "207.54.159.0" "whois.arin.net") ;use an alternate whois server |#