I have thousands of customers on my app with issues and its been close to 2 weeks and nothing from Corona. I have a Pro license and everything. No response to any posts and nothing more on the bug report. I honestly expected more support from you guys. Can anyone in the community confirm the same issue as above with lua sockets on the device vs simulator?
Hi @chevol,
Can I please have a bug case number for reference? And can you also please post the device and OS version you’re using for testing?
Thanks,
Brent
Hey Brent, cabe number is 34063. I have been testing with an iPhone 5S (iOS 7.1.2) an iPhone 5 (iOS 7.1.2) an iPad 3rd gen(iOS 7.1.2) a Galaxy S2 (Android 4.0.4) an original kindle (6.3.3) and a kindle fire HD. Sorry, I test on a lot of devices.
Thank you for the time and response by the way
hey all,
i tested this code, the slight mods i made were: 1, wrapping the socket calls in an assert() to check for any errors, and 2. adding a build.settings file for android internet access.
initially i seemed to be having trouble only on iOS, however, i’ve re-tested several times now and i was able to run the code and see the broadcast packets using Wireshark. (wireshark installed on an network-bridged ubuntu VM running on a laptop separate of computer running simulator.)
it worked on all of the following devices and builds:
test devices: simulator, iPhone 5s (7.1.1), iPod Touch (6.1.6), Galaxy S3 (4.0.4), Original Kindle (6.3.2), Nexus 7 (4.4.3)
i used two different Corona builds to make app/apk: 2013.2100 and 2014.2189, each build run on each device.
dunno what to say, 'cept it worked for me. =)
cheers,
dmc
local socket = require "socket" local broadcast local UDPBroadcaster = socket.udp() assert( UDPBroadcaster:setoption("broadcast", true), "setoption not working" ) assert( UDPBroadcaster:setsockname("\*", 0), "setsockname not working" ) assert( UDPBroadcaster:settimeout(0), "settimeout not working" ) function UDPBroadcast() UDPBroadcaster:sendto("SOME MESSAGE OR DATA", "255.255.255.255", 8080) print("broadcast") end broadcast = timer.performWithDelay(1000,UDPBroadcast,-1)
Thanks DMC,
I have a question, were you testing on an actual iOS device or just using the simulator? The simulator has no issues and you can see the UDP packets on port 8080 being broadcast. The issue is when that same code is run on an actual iOS device there are no UDP packets being sent out on 8080. Its strange that on a device it doesn’t broadcast, and this has been working for over a year in my app so I really think something odd is going on.
aside from the simulator, all of the other devices listed were _actual hardware_.
This is driving me nuts, lol. There seems to be no reason why it just seemed to have stopped working.
you said it used to work, have you tried to run it using an older build of Corona to see if that made a difference ? and just to clarify, are you having issues with iOS only or both iOS and Android ?
Yes, I have tried going back to an earlier build when it worked and still no go. Not sure what could be going on because it doesn’t make much sense. I have been focusing my testing on iOS but for right now its not working on either platform for me. Its odd too because users are complaining and the version they are on hasn’t changed code wise or Corona SDK wise.
chevol,
i did some more testing this morning:
* i updated my iPhone 5s from 7.1.1 to 7.1.2 to see if that made a difference
* i tested on an iPad Air (7.1.2)
with both devices i had the same results as yesterday - i can see the broadcast packets on my wifi network.
it’s strange that things would stop working with same code, same build. (and no change in hardware/os)
you’re using a regular wifi router and not a hotspot network from some device, yeah ? (i tried with wifi shared from iPhone hotspot network and that didn’t work)
cheers,
dmc
Yes, it is strange. I initially thought it was my router so I did a hard reboot and still the same issue. Using Packet Peeper (similar to Wire Shark) I can see UDP packet on 8080 using the simulator but the same code on the device gives me no UDP packets on 8080 and every second it should send out some data on port 8080. Yes I am using a regular router(Apple TimeCapsule) and not some shared wifi so I don’t think this is the issue.
I saw you are using WireShark, setting a filter to only see UDP data on port 8080, do you see packets being sent using an iOS device? There should be 1 every second.
This is just really getting to me as there seems to be no logic as to why its not working but you seem to have no issues. I also have seen a couple other posts about it not working too so I was really thinking that something was going on. But the fact that you have no issues is really putting my theory into question.
i’m not a wireshark pro, but i filtered on UDP and broadcast. with that i was able to get the data stream down to a reasonable amount to see what was happening. i see packets every second no matter if iOS or Android, and i only run one device at a time.
i updated the code sample so that the message would contain platform information in the broadcast:
local socket = require "socket" local broadcast local UDPBroadcaster = socket.udp() assert( UDPBroadcaster:setoption("broadcast", true), "setoption not working" ) assert( UDPBroadcaster:setsockname("\*", 0), "setsockname not working" ) assert( UDPBroadcaster:settimeout(0), "settimeout not working" ) function UDPBroadcast() local tbl = { "BROADCAST MSG from" } table.insert( tbl, system.getInfo( 'environment' ) ) table.insert( tbl, system.getInfo( 'model' ) ) table.insert( tbl, system.getInfo( 'platformName' ) ) table.insert( tbl, system.getInfo( 'platformVersion' ) ) tbl = table.concat( tbl, ' : ' ) UDPBroadcaster:sendto( tbl, "255.255.255.255", 8080 ) print("broadcast") end broadcast = timer.performWithDelay(1000,UDPBroadcast,-1)
and here are some screenshots of my results. you can see the above information in the bottom area with the hex dump:
Thank you so much DMC, but I still have no idea why I am having issues on my end. This information was helpful. I am still gonna continue with the troubleshooting on my end.
np Chevol ! i wish i could help more.
one last thing, i was wondering if you are you able to see *any* traffic from your devices with Packet Peeper ? (http requests etc)
Yes DMC, I am able to see other traffic coming fro my testing device just not UDP traffic on port 8080.
I spent hours last night testing and I think I have narrowed it down to my Apple TimeCapsule router. It has dual band and my laptop and test devices ALL are on the 5GHZ wireless. If I run Packet Peeper while the laptop is on the 5GHZ wireless I see all traffic except UDP port 8080 packets. If I switch JUST the laptop over to the non 5GHZ wireless I can see the UDP packets using Packet Peeper!
DMC if you didn’t tell me and show me it worked on your end I wouldn’t have gone thru as much troubleshooting as I did last night. Switching to the non 5GHZ wireless on my laptop running Packet Peeper was just one of those “let’s try if for shits and grins type of thing”.
I am still unable to communicate between 2 devices using AUTOLAN for some reason, but I’m still narrowing that down and its more then likely going to be network related.
that’s good news about your network discovery !
i did some searching for issues with apple time capsule and udp broadcast, but didn’t find anything of specific interest. nada.
FWIW, i did read some things that are REALLY REALLY long shots:
* read thread on SO, someone was having issues routing (general) traffic to a box, someone answered with “sounds like it could be an issue with an incorrect subnet mask”.
* longish read, but http://python.6.x6.nabble.com/Problem-receiving-UDP-broadcast-packets-td1642578.html
issue is that two machines have different IP address on *same* physical wire (which seems to be a valid network config), but broadcast from one doesn’t get to the other (correct network behavior??).
i assume you’re using DHCP which should negate all of those issues, but stranger things have happened. like i said, these are total long-shots. easy to check and confirm, but one might not ever think to look if it were the problem.
i can’t wait to know what the issue is. =)
Try 255.255.255.0