18. Internet Services

Simple DNS Lookups

;;;-----------------------------
(use-package :sb-bsd-sockets)
(defparameter *addresses* (host-ent-addresses (get-host-by-name name)))
;; *addresses* is a list of IP addresses (#(192 48 96 9) #(192 48 96 23))
;;;-----------------------------
(defun inet-ntoa (packed-address)
  (format nil "~{~D~^.~}" (coerce packed-address 'list)))

(defparameter *address* (inet-ntoa (make-inet-address *name*)))
;;;-----------------------------
(use-package :sb-bsd-sockets)
(defparameter *name* (get-host-by-address #(192 48 96 9)))
;; *NAME* is the hostname "ftp.uu.net"
;;;-----------------------------
(use-package :sb-bsd-sockets)
(defparameter *packed-address* (make-inet-address "208.146.140.1"))
(defparameter *ascii-address* (inet-ntoa *packed-address*)) ; INET-NTOA defined above
;;;-----------------------------
(use-package :sb-bsd-sockets)
(let* ((packed (get-host-by-name *hostname*)) ; no need for die, will signal a condition
       (address (host-ent-address packed)))
  (format t "I will use ~A as the address for ~A~%" address *hostname*))
;;;-----------------------------
;; *address* is the IP address I'm checking, like "128.138.243.20"
(use-package :sb-bsd-sockets)
(defparameter *name* (host-ent-name 
                      (get-host-by-address (make-inet-address *address*))))
(defparameter *addresses* (host-ent-addresses (get-host-by-name *name*)))
(defparameter *found* (member *address* *addresses* :test 'equal :key 'inet-ntoa))
;;;-----------------------------
;;; @@INCOMPLETE@@
;;;-----------------------------

Being an FTP Client

Sending Mail

Reading and Posting Usenet News Messages

Reading Mail with POP3

Simulating Telnet from a Program

Pinging a Machine

Using Whois to Retrieve Information from the InterNIC

Program: expn and vrfy