Sign in to follow this  
Followers 0
ercicttech

SAP Announcements

6 posts in this topic

Hello, all..

My workplace has an IP TV system where each TV channel is a UDP broadcast, with a SAP announcement.

For example:

"BBC TWO Scot" has an address of udp://239.192.37.11:5000

"BBC One" has an address of udp://239.192.33.11:5000

We can also broadcast compatible MPEG video files using VLC's streaming capabilities. So we can have test.mpg can be viewed on 239.192.0.1:1234 (etc)..

Users in the building can watch any TV station on a PC which has VLC installed (which is all of them), by using VLC's SAP discovery module

which lists all available channels on the Playlist. They're also viewable on receivers connected to each of the 6 42" plasma screens in the building, either via a remote control

(by walking up and physically changing the channel), or via a web interface.

Where I'm (slowly!) going with this is that I'm looking for some way of generating a list of the available channels, in much the same way as VLC's SAP discovery (as mentioned above).

The reason being that I've been asked to try to put together a fairly simple channel changing application so that members of staff can control the list. I'd rather this list was auto-updated via a discovery program, rather than having to get someone to remember the individual UDP streams used - particularly for the home-made streams getting broadcast from user's PCs.

So - I'm wondering if there's any way I can use Autoit's UDP support to do something like this? Or if there's some other way of doing it.

I basically want something where I can run a command where it'll sniff the channels out, and output the result to a text file (or something)..

Does anyone have any ideas? Suggestions? Anything? :-)

Cheers,

Gerard

Share this post


Link to post
Share on other sites



Hi there..

Does this look like it'll be of any use?

http://www.ietf.org/rfc/rfc2974.txt

[includes]

IPv4 administrative scope sessions using administratively scoped IP

multicast as defined in [7]. The multicast address to be used for

announcements is the highest multicast address in the relevant

administrative scope zone. For example, if the scope range is

239.16.32.0 - 239.16.33.255, then 239.16.33.255 is used for SAP

announcements.

SAP announcements MUST be sent on port 9875 and SHOULD be sent with

an IP time-to-live of 255 (the use of TTL scoping for multicast is

discouraged [7]).

(Sorry if this doesn't answer your question - I'm totally in the dark with this!)

Cheers,

Gerard

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

did you try listening to port 9875 (udp) ?

edit:

i had this laying around...

$sListenIp = ""
$sListenPort = 9875

UDPStartup()

$hSock = UDPBind($sListenIp,$sListenPort)
$sBuff = ""
$sIn = ""
While $hSock <> -1
    $sBuff = UDPRecv($hSock,15*1024)
    If StringLen($sBuff) > 0 Then
        $iTimer = TimerInit()
        $sIn = $sBuff
        While 1
            $sBuff = UDPRecv($hSock,15*1024)
            If StringLen($sBuff) > 0 Then
                $iTimer = TimerInit()
                $sIn &= $sBuff
            EndIf   
            If TimerDiff($iTimer) > 500 Then ExitLoop
        WEnd
        ConsoleWrite(@CRLF & "Received " & StringLen($sIn) & @CRLF)
        $sOut = _ShowPkg($sIn)
        ConsoleWrite($sOut)
    EndIf
    Sleep(250)
WEnd


Func _ShowPkg($sTmp)
    Local $iDumpSize = 16+8
    Local $iPtr = 1
    Local $iPtrMax = StringLen($sTmp)
    Local $sOut 
    While 1
        Local $sHex = ""
        Local $sLine = StringMid($sTmp,$iPtr,$iDumpSize)
        For $i = 1 To $iDumpSize
            Local $sChar = StringMid($sLine,$i,1)
            If StringLen($sChar) = 0 Then 
                $sOut &=" "
                $sHex &= "  "
                ContinueLoop    
            EndIf
            $iAsc = Asc($sChar)
            $sHex &= Hex($iAsc,2)
            If $iAsc > 31 And $iAsc < 128 Then
                $sOut &=$sChar
            Else
                $sOut &="."
            EndIf
        Next
        $sOut &=" " & $sHex & @CRLF
        $iPtr += $iDumpSize
        If $iPtr > $iPtrMax Then ExitLoop
    WEnd
    Return $sOut    
EndFunc
Edited by piccaso

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites

Hi there..

Thanks for that.. I'll give it a try at work tomorrow... Fingers crossed!

Cheers,

Gerard

Share this post


Link to post
Share on other sites

DOH! It didn't work..

It doesn't appear to be seeing anything at all...

I don't know if this will shed any light on it, but the source code for VLC's sap discovery is available online. Unfortunately, I know zero about C - I just frothed at the mouth trying to understand it :-)

I've copied and pasted the sections I think may be relevant?

[from sap.c]

/* SAP is always on that port */

#define SAP_PORT 9875

/* Global-scope SAP address */

#define SAP_V4_GLOBAL_ADDRESS "224.2.127.254"

/* Organization-local SAP address */

#define SAP_V4_ORG_ADDRESS "239.195.255.255"

/* Local (smallest non-link-local scope) SAP address */

#define SAP_V4_LOCAL_ADDRESS "239.255.255.255"

/* Link-local SAP address */

#define SAP_V4_LINK_ADDRESS "224.0.0.255"

#define ADD_SESSION 1

If any of that lot is of any use?

Sorry to sound a bit clueless with this :-(

Cheers,

Gerard

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0