mIRC Home    About    Download    Register    News    Help

Print Thread
#188746 29/10/07 10:01 PM
Joined: Jun 2003
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2003
Posts: 17
Hey guys, I'm needing a little bit of help with a minor script. Well, maybe a lot of help, because I honestly dont have a clue, but maybe I can find out if this is at least possible.

I have an xbox, which runs xbmc on my network, and I'm looking to detect a few of the functions froom this. The xbox runs a broadcast function in the background, which sends a UDP datagram whenever an error occurs (among other things).
Basically, I'm looking for a way to listen for this broadcast, and take the information from it, to store in a variable.

I've looked on the xbmc website, and found this information about the function.

The Broadcast facility uses the UDP broadcast protocol with a default port setting of 8278.
XBMC broadcasts on the IP address 255.255.255.255 which is the limited broadcast address.
The actual broadcasts are delimited by <b></b> and may consist of a numerical or textual description of the event (depening on the event)

I've used a small util which lets me see these on Windows, and one of the messages appears as "<b>OnPlayBackStarted;1</b>"
I know how to remove the <b>s etc, but I dont have a clue about the actual listening, or reading information.
Can anyone give me a clue as to whether this is possible, and how it would be done?
Thanks
Stefan Leroux


Swift as the Wind
Silent as a Forest
Fierce as Fire
Immovable as a Mountain
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Check the help file, /help /sockudp and /help on udpread

Basically you need to open a UDP socket with the -k switch and define a UDPread event to recieve the data.

Open the socket...
  • //sockudp -k xbox 8278 $ip 8278


and read the data...
Code:
on *:udpread:xbox:{
  var %a
  sockread -f %a
  echo -a %a
}


deegee #188756 30/10/07 02:35 AM
Joined: Jun 2003
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2003
Posts: 17
Thats absolutely perfect, thanks mate.

I had been checking the help files, but tbh, after 8 years my scripting is still absolutely rubbish, the best I came up with was
sockudp -k xbmc 192.168.0.20 8272
which obviously didnt work

So, thanks very, very much. smile

- I've added that to my script, and now the whole thing is working perfectly... so thanks again.

Last edited by Stefan_Leroux; 30/10/07 03:15 AM.

Swift as the Wind
Silent as a Forest
Fierce as Fire
Immovable as a Mountain

Link Copied to Clipboard