Jump to content

SAP Announcements

Recommended Posts

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://

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

We can also broadcast compatible MPEG video files using VLC's streaming capabilities. So we can have test.mpg can be viewed on (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? :-)



Link to comment
Share on other sites

Hi there..

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



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 -, then is used for SAP


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!)



Link to comment
Share on other sites

did you try listening to port 9875 (udp) ?


i had this laying around...

$sListenIp = ""
$sListenPort = 9875


$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
            If TimerDiff($iTimer) > 500 Then ExitLoop
        ConsoleWrite(@CRLF & "Received " & StringLen($sIn) & @CRLF)
        $sOut = _ShowPkg($sIn)

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 &= "  "
            $iAsc = Asc($sChar)
            $sHex &= Hex($iAsc,2)
            If $iAsc > 31 And $iAsc < 128 Then
                $sOut &=$sChar
                $sOut &="."
        $sOut &=" " & $sHex & @CRLF
        $iPtr += $iDumpSize
        If $iPtr > $iPtrMax Then ExitLoop
    Return $sOut    
Edited by piccaso
CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
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 */


/* Organization-local SAP address */

#define SAP_V4_ORG_ADDRESS ""

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


/* Link-local SAP address */

#define SAP_V4_LINK_ADDRESS ""

#define ADD_SESSION 1

If any of that lot is of any use?

Sorry to sound a bit clueless with this :-(



Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...