Question

I am trying to create a source client for an Icecast server on iOS.

I believe I understand the protocol here Icecast 2: protocol description, streaming to it using C#

However, I am having trouble creating the socket connection to the server. Say the server is running on port 8000 at http://myicecastserver.com. I setup a mountpoint called stream which works when ezstream is used as input. How should I open the connection from iOS?

I have used the AsyncSocket library like this:

[socket connectToHost:@"http://myicecastserver.com" onPort:8000 error:&err];

like this:

[socket connectToHost:@"http://myicecastserver.com/stream" onPort:8000 error:&err];

to no avail.

I also tried using a websocket connection with SocketRocket also to no avail:

SRWebSocket *socket = [[SRWebSocket alloc] initWithURL:[NSURL URLWithString:@"http://myicecastserver.com:8000/stream"]];
[socket setDelegate:self];
[socket open];

this gives me a 404 error

I have tried a few variations on this but just cannot open this connection to save my life! Thanks!

UPDATE

I am using SocketTest as a test source client and am able to connect to http://myicecastserver.com on port 8000

Was it helpful?

Solution

My solution is as follows:

I am using the AsyncSocket library like this:

[socket connectToHost:@"myicecastserver.com" onPort:8000 error:&err];

the trick was to remove 'http://' (yes, I am that silly) then on connect I can send the right headers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top