Parsing an incoming Shoutcast request
Andrew Lentvorski
bsder@REDACTED
Mon May 29 13:58:06 CEST 2006
Another newbie question.
I'm trying to do something very similar to the Shoutcast server sample
code from Practical Common Lisp. The initial request from an MP3 client
to the streaming server (which I want to write in Erlang) looks very
much like HTTP.
GET / HTTP/1.1\r\n
Host: 127.0.0.1:33669\r\n
User-Agent: VLC media player - version 0.8.5 Janus - VideoLAN team\r\n
Range: bytes=0-\r\n
Icy-MetaData: 1\r\n
Connection: Close\r\n
\r\n
Now, I know have to do the gen_tcp:listen and gen_tcp:accept to get the
actual connection socket.
Once, I have that socket, though, I either need to do something with
messages and {active, once} or gen_tcp:recv() and {active, false}.
I can't see a particularly obvious way to structure this for pattern
matches to make things easy.
Given that this looks like it should be very ripe for some form of
pattern match, I thought I would try asking those with more experience
for some friendly advice before plowing ahead and writing lots of very
stupid code.
Thanks,
-a
More information about the erlang-questions
mailing list