gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Re: Server sockets with GCL?


From: Jeff Dalton
Subject: [Gcl-devel] Re: Server sockets with GCL?
Date: Wed, 05 May 2004 17:24:16 +0100 (BST)
User-agent: IMP/PHP IMAP webmail program 2.2.8

Quoting Chris Hall <address@hidden>:

> > What I'm confused about is how to take the results obtained from
> > calling ACCEPT-SOCKET-CONNECTION and derive a pair of streams.
> 
> I'd like to do this, too, but after looking at the existing C socket
> code that I can find in GCL and reading what Camm has to say, it seems
> it some work needs to be done on the C side.  I am, when I can spend
> the time, learning what I can about C socket programming on Linux.

When I did socket stuff in GCL in order to write an HTTP server,
I wrote a function called accept-socket-connection that returned
an df (ie, an int), and I wrote something called fdopen that
would return a Lisp input or output stream.  Then

(defun socket-connection-stream (s)
  (let ((fd (accept-socket-connection s)))
    (make-two-way-stream
      (fdopen fd :input)
      (fdopen fd :output))))

fdopen was named after the C procedure that makes a FILE from an fd.

I could then do normal I/O with the resulting stream.

All of this was reasonably straightforward to do using the C
interface.

I'm not sure how freely available my code is, though it's supposed
to become open source as part of O-Plan (an AI planning system)
at some point.

However, I'd be ahppy to try to help other people with such
things where I can.

BTW, is there any documentation for the GCL C interface.
My copy of the KCL manual was destroyed in a fire, and I
couldn't find anything on-line.

-- Jeff




reply via email to

[Prev in Thread] Current Thread [Next in Thread]