From: Julian Stecklina
Subject: simple-streams
Date: 
Message-ID: <86zmr1mvpg.fsf@dellbeast.localnet>
Hello,

say I wanted to write a kind of simple-stream that inherits most
functionality of an ordinary TCP stream, but it gets an URL and has to
do some parsing of the data from the network connection. I am quite
puzzled at how to implement that using the simple-stream interface.

I thought of something along the lines of:

(def-stream-class shoutcast-stream (socket-stream-internet-active)
  ...)

(defmethod device-open ((stream shoucast-stream) slot-names initargs)
  (let ((res (call-next-method <What does socket-stream-i-a expect
here??>)))
    (when res
       (parse-http-stuff ...))))

The tricky part is: What do I pass to the inherited device-open
method?

Any pointers? Am I roughly on the right track?

Regards,
-- 
Julian Stecklina

(Of course SML does have its weaknesses, but by comparison, a
 discussion of C++'s strengths and flaws always sounds like an
 argument about whether one should face north or east when one
 is sacrificing one's goat to the rain god.)         -- Thant Tessman

From: GP lisper
Subject: Re: simple-streams
Date: 
Message-ID: <1125281528.0d8574a26d52b12bee9a5493eeaaf21c@teranews>
On Mon, 29 Aug 2005 02:29:47 +0200, <··········@web.de> wrote:
>
>
> Hello,
>
> say I wanted to write a kind of simple-stream that inherits most
> functionality of an ordinary TCP stream, but it gets an URL and has to
> do some parsing of the data from the network connection.
>
> Any pointers? Am I roughly on the right track?

Try Cliki for:

trivial-http
cl-yahoo

-- 
Program A uses CLOS, Program B is implemented with structs, leading
to a fourfold increase in execution speed.  --J. B. Heimatseiten
From: Julian Stecklina
Subject: Re: simple-streams
Date: 
Message-ID: <86vf1oq4g1.fsf@dellbeast.localnet>
GP lisper <········@CloudDancer.com> writes:

> trivial-http
> cl-yahoo

trivial-http would solve the "Making a HTTP GET request"-problem, but
does not show me how to use the simple-stream interface.

Regards,
-- 
Julian Stecklina

(Of course SML does have its weaknesses, but by comparison, a
 discussion of C++'s strengths and flaws always sounds like an
 argument about whether one should face north or east when one
 is sacrificing one's goat to the rain god.)         -- Thant Tessman
From: GP lisper
Subject: Re: simple-streams
Date: 
Message-ID: <1125324021.8e1d1c1a70307eb7a1dd1f4d96e5bf07@teranews>
On Mon, 29 Aug 2005 15:05:02 +0200, <··········@web.de> wrote:
> GP lisper <········@CloudDancer.com> writes:
>
>> trivial-http
>> cl-yahoo
>
> trivial-http would solve the "Making a HTTP GET request"-problem, but
> does not show me how to use the simple-stream interface.

I'm not sure what you are asking here.  The difference between simple
and grey streams, or how to use the TCP streams?  If the latter,
'trivial-sockets' (which trivial-http depends upon) shows basic telnet
connections.

(defun test-server ()
  (let ((stream (trivial-sockets:open-stream "192.168.100.1" 6666)))
    (loop for message = (read stream nil :eof)
          until (eq message :eof)
          do (print message))))


-- 
Program A uses CLOS, Program B is implemented with structs, leading
to a fourfold increase in execution speed.  --J. B. Heimatseiten
From: Julian Stecklina
Subject: Re: simple-streams
Date: 
Message-ID: <8664tordmf.fsf@dellbeast.localnet>
GP lisper <········@CloudDancer.com> writes:

> On Mon, 29 Aug 2005 15:05:02 +0200, <··········@web.de> wrote:
>> GP lisper <········@CloudDancer.com> writes:
>>
>>> trivial-http
>>> cl-yahoo
>>
>> trivial-http would solve the "Making a HTTP GET request"-problem, but
>> does not show me how to use the simple-stream interface.
>
> I'm not sure what you are asking here.  The difference between simple
> and grey streams, or how to use the TCP streams?  If the latter,
> 'trivial-sockets' (which trivial-http depends upon) shows basic telnet
> connections.
>
> (defun test-server ()
>   (let ((stream (trivial-sockets:open-stream "192.168.100.1" 6666)))
>     (loop for message = (read stream nil :eof)
>           until (eq message :eof)
>           do (print message))))

I am sorry, if I was not clear. I want to create a stream class that
extends a basic tcp stream with MP3 streaming capabilities. This
should look like an ordinary stream to the outside world and my basic
problem is with the simple-streams interface not with networking in
general. I know how to deal with streams, I just do not know how to
implement them using simple-streams.

What I am asking is: 

Is there an example of how to extend a socket-stream-* class (from
ACL's socket class hierarchy) with new functionality?

Regards,
-- 
Julian Stecklina

(Of course SML does have its weaknesses, but by comparison, a
 discussion of C++'s strengths and flaws always sounds like an
 argument about whether one should face north or east when one
 is sacrificing one's goat to the rain god.)         -- Thant Tessman
From: GP lisper
Subject: Re: simple-streams
Date: 
Message-ID: <1125365059.144381a22585c3f2149d40b653b55ae8@teranews>
On Mon, 29 Aug 2005 17:01:28 +0200, <··········@web.de> wrote:
> GP lisper <········@CloudDancer.com> writes:
>
>> On Mon, 29 Aug 2005 15:05:02 +0200, <··········@web.de> wrote:
>>> GP lisper <········@CloudDancer.com> writes:
>>
>> I'm not sure what you are asking here.  The difference between simple
>> and grey streams, or how to use the TCP streams?  If the latter,
>> 'trivial-sockets' (which trivial-http depends upon) shows basic telnet
>> connections.
>
> I am sorry, if I was not clear. I want to create a stream class that
> extends a basic tcp stream with MP3 streaming capabilities. This
> should look like an ordinary stream to the outside world and my basic
> problem is with the simple-streams interface not with networking in
> general. I know how to deal with streams, I just do not know how to
> implement them using simple-streams.
>
> Is there an example of how to extend a socket-stream-* class (from
> ACL's socket class hierarchy) with new functionality?

Have you seen Practical Common Lisp?  Peter has a section towards the
end that covers shoutcast/icecast servers.  He discusses some of the
problems with adding the ID3 info for MP3s, if I recall correctly.


-- 
Program A uses CLOS, Program B is implemented with structs, leading
to a fourfold increase in execution speed.  --J. B. Heimatseiten
From: Julian Stecklina
Subject: Re: simple-streams
Date: 
Message-ID: <86hdd7y1hj.fsf@dellbeast.localnet>
GP lisper <········@CloudDancer.com> writes:

>> Is there an example of how to extend a socket-stream-* class (from
>> ACL's socket class hierarchy) with new functionality?
>
> Have you seen Practical Common Lisp?  Peter has a section towards the
> end that covers shoutcast/icecast servers.  He discusses some of the
> problems with adding the ID3 info for MP3s, if I recall correctly.

This chapter is quite nice, but again: My problem is not at all with
MP3 streaming per se... Luckily I completed the simple-stream
implementation yesterday evening.

Regards,
-- 
Julian Stecklina

(Of course SML does have its weaknesses, but by comparison, a
 discussion of C++'s strengths and flaws always sounds like an
 argument about whether one should face north or east when one
 is sacrificing one's goat to the rain god.)         -- Thant Tessman