From: Peter Herth
Subject: sockets in cmucl
Date: 
Message-ID: <m2902g2wf5.fsf@cepheus.kri.uni-koeln.de>
Hi, 

I am digging for some days now in the cmucl documentation
to figure out, how sockets are done in cmucl. The only thing
I could find via apropos were functions like create-inet-socket
and connect-to-inet-socket, their names sounds promising, but
could not find any documentation about them. What I need
is a simple tcp/ip socket connected to a stream for reading
and writing text. If anyone could provide me with a pointer
to a documentation or even a small snippet I would be grateful.

Peter

From: Daniel Barlow
Subject: Re: sockets in cmucl
Date: 
Message-ID: <8766xkm4t7.fsf@tninkpad.telent.net>
Peter Herth <·····@cepheus.kri.uni-koeln.de> writes:
> I am digging for some days now in the cmucl documentation
> to figure out, how sockets are done in cmucl. The only thing
> I could find via apropos were functions like create-inet-socket
> and connect-to-inet-socket, their names sounds promising, but
> could not find any documentation about them. What I need

UTSL, as Unix weenies are wont to say.  Download the CMUCL source and
look at src/code/internet.lisp.  For an example, I have an SMTP client
which does something akin to

(defun open-tcp-connection (server port)
  "Open connection to SERVER on PORT, returning a stream or NIL on failure"
  (let* ((socket (connect-to-inet-socket server port)))
    (if socket (system:make-fd-stream socket :input t :output t
                                      :buffering :none))))

(open-tcp-conection "localhost" 25) ;; etc etc

You might (and I emphasise _might_, it's quite possibly no use to man
or beast) also want to look at Araneida, my toy CMUCL-based web
server: http://ww.telent.net/lisp/araneida.html

-dan
From: Don Geddis
Subject: Re: sockets in cmucl
Date: 
Message-ID: <slrn86ggc3.mhc.geddis@jedi.tesserae.com>
On 27 Dec 1999 17:14:22 +0100, Peter Herth <·····@cepheus.kri.uni-koeln.de> wrote:
> I am digging for some days now in the cmucl documentation
> to figure out, how sockets are done in cmucl. The only thing
> I could find via apropos were functions like create-inet-socket
> and connect-to-inet-socket, their names sounds promising, but
> could not find any documentation about them.

There's also a user manual and full source code (much of it in lisp!).  You can
find links at the home page:
	http://www.cons.org/cmucl/
You can check the source code file
	.../cmucl/src/code/internet.lisp
to see the details on TCP streams, and
	.../cmucl/src/code/unix.lisp
if you want to see the low-level connection to the unix OS calls.

There's even a port of CL-HTTP (with source code), if you want to see how to
build a full-featured web server in CMUCL.

> What I need is a simple tcp/ip socket connected to a stream for reading and
> writing text. If anyone could provide me with a pointer to a documentation or
> even a small snippet I would be grateful.

Perhaps this will get you started...a simple function to connect to a web
server, download some page, and print it:

	(defun get-url (path &optional (host "www.yahoo.com"))
	  (let (fd st)
	    (setq fd (ext:connect-to-inet-socket host 80))
	    (setq st (system:make-fd-stream fd :input t :output t))
	    (format st "GET ~A HTTP/0.9~2%" path)
	    (force-output st)
	    
	    (loop
		for line = (read-line st nil nil)
		while line
		do (format t "~A~%" line) )
	    (values) ))

_____________________________________________________________________________
Don Geddis                ······@cadabra.com               Phone 650-403-2220
Cadabra Inc.              http://cadabra.com                 Fax 650-403-2201
1820 Gateway Drive, Suite 300, San Mateo, CA 94404          Main 650-403-2200
From: Paolo Amoroso
Subject: Re: sockets in cmucl
Date: 
Message-ID: <gcVnOLjqC9yZCwFiZk60duRgzthn@4ax.com>
On 27 Dec 1999 17:14:22 +0100, Peter Herth <·····@cepheus.kri.uni-koeln.de>
wrote:

> I am digging for some days now in the cmucl documentation
> to figure out, how sockets are done in cmucl. The only thing

See section "Using it/Networking" of:

  CMU Common Lisp on Linux
  http://www.telent.net/lisp/howto.html

by Daniel Barlow. Also check function MP:START-LISP-CONNECTION-LISTENER in
the multi-proc.lisp file of the CMU CL source distribution.


Paolo
-- 
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://cvs2.cons.org:8000/cmucl/doc/EncyCMUCLopedia/