UDP broadcast on a Mac?
Malte Brill
revolution at derbrill.de
Wed Nov 7 06:59:53 EST 2012
Hi all,
a while back, I asked about push notifications on the desktop. (Thanks again Mark and Alex) and finally I get around to play with the idea. While I get it to broadcast nicely from Windows to the Mac (and the other win machines in my network), trying from the Mac fails. This is the code:
#############
#Receiving part:
#############
on mouseUp pBtnNum
if the label of me = "Start" then
accept datagram connections on port 9997 with message "dataReceived"
set the label of me to "Stop"
else
close socket 9997
set the label of me to "Start"
end if
end mouseUp
on dataReceived pSocket, pMsg
answer pSocket & cr & pMsg
end dataReceived
on socketError
answer "Failed to open server socket"
end socketError
#############
# Sending part:
#############
on mouseUp
if fld "fldMsg" is not empty then
local tPartner
put fld "thePartner" into tPartner
put ":9997" after tPartner
open datagram socket to tPartner
if the result is not empty then
answer "Socket: " & the result
end if
write fld "fldMsg" to socket tPartner
close socket tPartner
put "" into fld "fldMsg"
else
beep
end if
end mouseUp
on socketError
answer "Failed to open socket"
end socketError
Has anyone successfully broadcasted from a Mac? If so, could you please enlighten me on how you did it?
Many thanks!
Malte
More information about the use-livecode
mailing list