UDP Datagrams to Broadcast Address

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
chaywesley
Posts: 1
Joined: Wed Jun 22, 2011 7:08 pm

UDP Datagrams to Broadcast Address

Post by chaywesley » Wed Jun 22, 2011 7:21 pm

Hi,

I'm having trouble sending upd datagram pakets to the local broadcast address. Here is a snippet of code:

Code: Select all

local OWServerDiscoverySocket_tx = "255.255.255.255:30303"
local OWServerDiscoverySocket_rx = 30303
command DiscoverOWServers
   if OWServerDiscoverySocket_tx is not in the openSockets then
      accept datagram connections on port OWServerDiscoverySocket_rx with message "OWServerDiscovery_ResponseReceived"
      open datagram socket to OWServerDiscoverySocket_tx
      if the result is not empty then answer the result
   end if
   write ("Discovery: Who is out there?") to socket OWServerDiscoverySocket_tx
end DiscoverOWServers
After this bit of code runs, a quick netstat shows that both of the sockets are open as far as the OS is concerned:

Code: Select all

Chay-Wesleys-MacBook-Pro:~ chaywesley$ netstat -an | grep 30303
udp4       0      0  172.16.10.27.60140     255.255.255.255.30303  
udp4       0      0  *.30303                *.*              
However, running a sniff with Wireshark reveals that no data is actually put on the wire by the "write to socket" command. I've generally had success with socket based communication with Live Code, including multicasting, but I'm having no luck with broadcast. Do I appear to be missing something, or is this a known issue / limitation?

Any advice would be appreciated.

Thanks,

Chay Wesley

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: UDP Datagrams to Broadcast Address

Post by mwieder » Wed Jun 22, 2011 9:26 pm

It's been my experience that broadcast UDP sockets work on linux and Windows but not on OSX.

Post Reply