Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
iOS Player, can not receive broadcast package — Gideros Forum

iOS Player, can not receive broadcast package

RickyngkRickyngk Member
edited April 2013 in General questions
Hi, I do a quick test with lua socket
local isServer = false
 
local port = 5885
local function __getIP()
	local s = socket.udp()
	s:setpeername("66.147.244.100",80)
	local ip, _ = s:getsockname()
	s:close()
	return ip
end
 
listen = socket.udp() 
listen:setsockname(__getIP(),port)
listen:settimeout(0)
 
stage:addEventListener(Event.ENTER_FRAME, function()
		if isServer then
			listen:setoption('broadcast', true)
			assert(listen:sendto("hello", "255.255.255.255", port))
			listen:setoption('broadcast', false)
		else
			repeat
				local data, ip, port = listen:receivefrom()
				if data then
					print(data, ip, port)
				end
			until not data
		end
	end
)
If pc-player is client, and iOSPlayer is host (do broadcast), it's ok. But if iOSPlayer is client (receive broadcast), I can not get any income package.

Did I make something wrong ? Thx

Comments

Sign In or Register to comment.