xboxscene.org forums

Author Topic: Problem With Udp Broadcast  (Read 687 times)

baabaa

  • Archived User
  • Newbie
  • *
  • Posts: 2
Problem With Udp Broadcast
« on: April 06, 2006, 05:58:00 PM »

Hello!
I have a simple script running at the xbox:

from socket import *

host = ''
port = 1500
buf = 1024
addr = (host,port)
UDPSock = socket(AF_INET,SOCK_DGRAM)
UDPSock.bind(addr)

while 1:
   data,addr = UDPSock.recvfrom(buf)
   if not data:
      print "Client has exited!"
      break
   else:
      print "\nReceived message '", data,"'"
      s=str(data)
      f=open("q:\\scripts\\workfile.txt", "a")
      f.write(s)
      f.write('\n')
      f.close()
      
UDPSock.close()

Later im gonna display the message onscreen instaed of writing to HDD.

But my problem is this:
If i send a packet from my linux-box with destination adress 192.168.0.4 (adress of the xbox), everything works.
But, if I send the packet with the adress 192.168.0.255, the network broadcast adress, the xbox wont recive the packet.
I have also run the same app at my workstation pc, and the pc will recieve the broadcast packet.

So my question is:
what to do? does XBMC / the xbox not support recieving of broadcast packets?
or do I need to do something special?
thnx in advice
baabaa smile.gif
Logged

LostIt

  • Archived User
  • Jr. Member
  • *
  • Posts: 86
Problem With Udp Broadcast
« Reply #1 on: April 10, 2006, 12:02:00 PM »

Try broadcasting to 255.255.255.255

This post has been edited by LostIt: Apr 10 2006, 07:04 PM
Logged

baabaa

  • Archived User
  • Newbie
  • *
  • Posts: 2
Problem With Udp Broadcast
« Reply #2 on: April 11, 2006, 10:45:00 AM »

QUOTE(LostIt @ Apr 10 2006, 07:33 PM) *

Try broadcasting to 255.255.255.255


thnx for your input, I just tested it, works on windows/linux but not on the xbox (IMG:style_emoticons/default/sad.gif)
argh this is so annoying, I cant find any reason for why the xbox/xbmc should reject incoming broadcast packets?

for the moment I have changed the server to make a broadcast (for my pc / linux machines) + unicast for the xbox, but it´s a so ugly solution.

but since this way it works, I´ll guess its better to change the server-code a bit (maybe a config-file containing a list of unicast ip´s the server software reads)
Logged