Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Accept source connection only if listener is connected

 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server
View previous topic :: View next topic  
Author Message
level20peon



Joined: 24 Feb 2008
Posts: 19

PostPosted: Sun Mar 16, 2008 6:24 pm    Post subject: Accept source connection only if listener is connected Reply with quote

Hey guys,

an answer to what I would like to know is hard to figure through search, because it is kind of a "on-demand" request but not the way it usually is used in the forums.

I would like the icecast server to not open the source connection if there isn't a listener connected (source=stream, not local file on demand streaming). I would like to do this because I don't want to use my upload bandwith to my icecast server all the time if there isn't anyone listening anyway.

Is this possible ? I hope you understand what I am trying to ask here at all Very Happy


-level20peon
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sun Mar 16, 2008 7:17 pm    Post subject: Reply with quote

The way you described it is impossible because a listener cannot connect to a stream unless the source is already streaming. However you can stream to a local icecast (local to the source client) and configure the existing icecast with an on-demand relay. That way you can prevent the stream using up bandwidth when there are no listener.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
level20peon



Joined: 24 Feb 2008
Posts: 19

PostPosted: Fri Apr 11, 2008 6:45 pm    Post subject: Reply with quote

Thanks for your reply. Could you please elaborate your scenario ? I checked the icecast documentation on relaying and think that "master-slave" relaying is what you mean.

I think the master would be the local server and the slave server would be hosted by some (from my point of view) remote computer ?

If so: The manual states that the slave will connect to the master as soon as it (the slave) is started. So it uses bandwith any time, no matter if a listener is connected to the slave or not.

What am I missing in this scenario ?


-level20peon
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Fri Apr 11, 2008 8:08 pm    Post subject: Reply with quote

It doesn't need the <master-*> tags, a simple <relay> with <on-demand> setting enabled will be sufficient on the remote icecast. Remote from yourself but the server that your listeners will connect to.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
level20peon



Joined: 24 Feb 2008
Posts: 19

PostPosted: Fri Apr 11, 2008 9:39 pm    Post subject: Reply with quote

Works like a charm, thank you. One question though:

It this setup also possible using logins (remote server needs login for local server) or is the login solely necessary for querying a mountpoing list ?


-level20peon
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sat Apr 12, 2008 12:14 am    Post subject: Reply with quote

If you want the <relay> to pass a login/password for your local icecast then use the <username> <password> tags in <relay>. If you want authentication for listeners on the relay then define what authentication you need in the <mount> that matches the <relay>

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
level20peon



Joined: 24 Feb 2008
Posts: 19

PostPosted: Sat Apr 12, 2008 7:11 am    Post subject: Reply with quote

Sorry I should have specified more clearly what I want Wink


I have entered the following into the local servers config

Code:

    <authentication>
        <!-- Sources log in with username 'source' -->
        <source-password>password</source-password>
        <!-- Relays log in username 'relay' -->
        <relay-password>password</relay-password>
        <!-- Admin logs in with the username given below -->
        <admin-user>admin</admin-user>
        <admin-password>password</admin-password>
    </authentication>



The remote servers config contains

Code:

 <relay>
        <server>IP</server>
        <port>8000</port>
        <mount>/stream</mount>
        <local-mount>/stream</local-mount>
   <username>relay</username>
        <password>password</password>
        <on-demand>1</on-demand>
        <relay-shoutcast-metadata>1</relay-shoutcast-metadata>
    </relay>



However if I enter something different in the <relay> <password> section it connects anyway.

I want the remote server to need to login to the local server... the listeners (connecting to the remote server) shouldn't need a login to listen to the stream.


-level20peon
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sat Apr 12, 2008 1:33 pm    Post subject: Reply with quote

That is because you misunderstand what the global authentication block is for. You are right in that the relay-user/pass is for a master/slave setup but you don't have that so it doesn't apply.

What you want is an authentication block within a mount section but if you don't want listener auth to apply locally then you'll need a separate mountpoint for the relay eg

local icecast

/A --> for local listener, not auth'd
/B --> mountpoint that gets auth but is a relay of /A and can be on-demand in itself.

and the remote icecast relays /B with the appropriate user/pass.

The other possibility is to have the source stream to an auth'd mountpoint, have the remote relay as above and have a local relay for your listeners which has no auth on it.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
level20peon



Joined: 24 Feb 2008
Posts: 19

PostPosted: Sun Apr 13, 2008 8:34 am    Post subject: Reply with quote

ok I tried for quite some time now without success so I would like to ask if this is even possible the way I am trying:

Are you suggesting to use TWO instances of icecast locally ?

Is your suggestion working using Shoutcast DSP as input source ?


-level20peon


EDIT: Setting up two local mounts is no problem but no matter what I try the /b mountpoint is never resctricted... I can always listen to it, no matter what user / password configurations I try.

EDIT2: I missed something in the configuration. It seems to work now. Thank you for helping me Wink
Back to top
View user's profile Send private message
level20peon



Joined: 24 Feb 2008
Posts: 19

PostPosted: Sun Apr 13, 2008 10:28 am    Post subject: Reply with quote

There is another thing turning up after setting up everything:

There are now two mounts locally eg /a and /b.
I am relaying /b to the remote server.

However I have to open one port in my Router (8000 per default) so anybody who wants to listen to the local mounts and tries to connect to /b won't be able to listen to the stream because it is protected. If he tries to connect to /a however he can listen to the stream without login (which is not really a good solution).

So is it possible to keep /a without login but make it available for local network only, OR map it to another port which is not opened in my router ?

I checked the manual on this but there doesn't seem to exist a possibility to map specific mountpoints to specific ports without having to use two instances of icecast ?


-level20peon
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sun Apr 13, 2008 2:13 pm    Post subject: Reply with quote

If you are really concerned about a non-public mountpoint being accessible then you can work around by being a bit sneaky

Listen on 2 ports. one reserved for the external /b mountpoint, this is open in your firewall. second port is blocked on firewall but used by local listeners. Then add something like

<alias port=ExternalPortNo source="/a" dest="/b" />

it doesn't have to map to /b, it could be a html file.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
level20peon



Joined: 24 Feb 2008
Posts: 19

PostPosted: Sun Apr 13, 2008 2:45 pm    Post subject: Reply with quote

Thanks Karl, this is great.

Maybe you could add this information to the documentation because the "port" directive of the "alias" redirect just can be found in the sample config file which doesn't display its use very clearly either (imo).

You made my day, thanks again Very Happy


-level20peon
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
subRebel style by ktauber