A SHOUTcast Server
To finish off this chapter, we’ll use our newly acquired skills in socket programming to write a SHOUTcast server. SHOUTcast is a protocol developed by the folks at Nullsoft for streaming audio data.[18] SHOUTcast sends MP3- or AAC-encoded audio data using HTTP as the transport protocol.
To see how things work, we’ll first look at the SHOUTcast protocol. Then we’ll look at the overall structure of the server. We’ll finish with the code.
The SHOUTcast Protocol
The SHOUTcast protocol is simple.
-
First the client (which can be something like XMMS, Winamp, or iTunes) sends an HTTP request to the SHOUTcast server. Here’s the request that XMMS generates when I run my SHOUTcast server at home:
GET / HTTP/1.1 Host: localhost
Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.