anchor.diff:  				,@body)
   			(stop-sockets))))
   
  -(defun host-to-ipaddr (dotted-or-name)
  -	"Return the ipaddr given a host name or dotted IP address."
  -	(let* ((name (lisp-string-to-c-string dotted-or-name))
  -			(ipaddr (inet_addr name)))
  -		(when (and (= ipaddr INADDR_NONE)
  -				(not (equal dotted-or-name "255.255.255.255")))
  -			(setq ipaddr
  -				(let* ((he (with-winsock-pointer-expected () 
  -								(gethostbyname name)))
  -						(addr-list (cref hostent he winsock::h_addr_list))
  -						(addr0 (cref ((:unsigned-long *) *) addr-list 0)))
  -					(cref (:unsigned-long *) addr0 0))))
  -		ipaddr))
  -
  -(defun ipaddr-to-name (ipaddr)
  -	"Given an ipaddr, lookup the host name"
  -	(with-fresh-foreign-block (temp-ipaddr :unsigned-long)
  -		(setf (cref (:unsigned-long *) temp-ipaddr 0) ipaddr)
  -		(c-string-to-lisp-string
  -			(cref hostent
  -				(with-winsock-pointer-expected ()
  -					(gethostbyaddr temp-ipaddr (sizeof :unsigned-long) AF_INET))
  -				winsock::h_name))))
  -					
  -			
  -(defun ipaddr-to-dotted (ipaddr)
  -	"Given ipaddr, return the dotted name."
  -	(c-string-to-lisp-string 
  -		(with-winsock-pointer-expected ()
  -			(inet_ntoa (int-to-foreign-ptr ipaddr)))))
  +(defvar *ipv6* nil "Controls whether IPv6 addresses will be looked up by default during name resolution. Valid values: nil, :only or t")
  +
  +(defun ipv6-installed-p () (get-addr-info "::" :ipv6 :only))
  +
  +;;; An ADDR is a plist of the form
  +;;; (:family AF_INETx :port p :flow f :ipaddr #(B1...Bi...Bn) :scope s :dotted string)
  +;;; where x is 6 for IPv6, p, f, and s are integers, Bi is a Byte integer representation, n is 4 for IPv4 and 16 for IPv6,
  +;;; and string is a dotted or colon representation for information purposes only.
  +;;; For IPv4 the properties flow and scope are not used.
  +
  +;;; In a protocol-independent approach, it is more convenient to use the ADDR instead of the ipaddr proper.
  +;;; We define the functions host-to-ipaddr, ipaddr-to-dotted and ipaddr-to-dotted with this in mind.
  +
  +(defun host-to-ipaddr (dotted-or-name &key port (ipv6 *ipv6*)) "Return the ipaddr (addr) given a host name or dotted IP address.
  +Port: symbol, string or integer. IPv6: nil, :only or t"
  +    (get-addr-info dotted-or-name :port (or port 0) :host-is-name :unspec :ipv6 ipv6 :errorp t))
  +
  +(defun ipaddr-to-name (addr) "Given an ipaddr (addr), lookup the host name"
  +    (get-name-info addr :errorp t))
  +
  +(defun ipaddr-to-dotted (addr) "Given ipaddr (addr), return the dotted name."
  +    (or (getf addr :dotted) (get-name-info addr :dottedp t :errorp t)))
   
   (defclass base-socket ()
   	((socket-descriptor 
  
positive.code: ;;;;              Removed redundant read-line, write-line functions which are not
  ;;;;              needed here (the standard versions of those functions will support sockets).
  ;;;;
  (require 'WINSOCK)
  
  (defpackage "SOCKETS"
  
negative.code: 		"START-SOCKETS"
  		"STOP-SOCKETS"
  		"WITH-SOCKETS-STARTED"
                          "*IPV6*"
                          "IPV6-INSTALLED-P"
                          "HOST-TO-IPADDR"
  		"IPADDR-TO-NAME"
  		"IPADDR-TO-DOTTED"
  		"BASE-SOCKET"
  