LuaSockets Data Corruption

I have now submitted a bug report. My findings are as follows

Transmitting large blocks of data over tcp using luasockets (eg ~6k) intermittantly corrupts when received. The client/server receive() function is doing one of two things (randomly)

  1. It returns an incomplete packet (the beginning is missing, not the end). The receive function is not returning any errors
  2. It returns a non-table data packet. It is just the number 14.

I made a test program that demonstrates this. The test program pings 6k messages back and forth between a server and client. It will occur randomly (anywhere from 1 ping to a few hundred pings before it happens.)

NOTE: The test MUST be performed across a proper network. Running two simulators on the same computer does NOT produce the problem. I have reproduced using two simulators on different computers, 1 simulator and one device (iPad3) and also 2 devices (iPad4 and iPhone5).
[import]uid: 110197 topic_id: 33837 reply_id: 135296[/import]

Thanks for creating a test case and filing the bug. We can look at this but if the problem is in LuaSockets, we may not be able to provide a solution since LuaSockets is a third party library that we include in Corona. There is an unofficial updated library available but if we included it in Corona, we don’t know what other issues it may cause. We need to wait for a tested and official release of the library but that may not happen anytime soon (if ever). We know the updated library fixes the existing base64 bug, but we not comfortable updating the library.

With that said, we can look at your test case and see if there anything we can do.

[import]uid: 7559 topic_id: 33837 reply_id: 135300[/import]

Thanks Tom, just wondering if you could give me a rough estimate of when this issue would be looked at (eg days, weeks or months) so i can figure out whether to wait to see the outcome or whether i will need to start looking at alternatives myself asap.
Cheers [import]uid: 110197 topic_id: 33837 reply_id: 135733[/import]

Ok thanks Tom, I look forward to seeing what you find.

If it is a bug with the luasocket library, would there be a possibility of having a new option in the build.settings file to enable compiling with the new library? That way it would only be used by people who wanted to test the latest library and wouldnt affect anyone else. (not sure if this is possible with your compiler setup).

Alternatively are there any other networking libraries that you work with Corona? I would have thought this sort of networking would be quite heavily used for multiplayer games.

Cheers
Craig [import]uid: 110197 topic_id: 33837 reply_id: 135420[/import]

On an unrelated note, is there a way to change the name of the thread?
“Help, dispatch events failing” doesnt really seem to apply anymore, may be more useful to other people with a better name [import]uid: 110197 topic_id: 33837 reply_id: 135421[/import]

We took a look at it yesterday and was able to reproduce the error with your great test case. We used Wireshark to trace what was going on and found it failed when there was a TCP error and it issued a retry. That’s when the packets stopped.

We will look at it a little more but it looks to be a bug in LuaSockets. We don’t have the ability to add in the new “unofficial” library and allow switching between the two libraries so I’m not sure what we can do about it. We will discuss it more today and I will let you know what we decide to do. [import]uid: 7559 topic_id: 33837 reply_id: 135752[/import]

I changed the thread name but left the page URL the same. [import]uid: 7559 topic_id: 33837 reply_id: 135528[/import]

Thanks Tom, just wondering if you could give me a rough estimate of when this issue would be looked at (eg days, weeks or months) so i can figure out whether to wait to see the outcome or whether i will need to start looking at alternatives myself asap.
Cheers [import]uid: 110197 topic_id: 33837 reply_id: 135733[/import]

Ok thanks for looking at it so quickly. I will wait to hear what you decide to do. [import]uid: 110197 topic_id: 33837 reply_id: 136073[/import]

We took a look at it yesterday and was able to reproduce the error with your great test case. We used Wireshark to trace what was going on and found it failed when there was a TCP error and it issued a retry. That’s when the packets stopped.

We will look at it a little more but it looks to be a bug in LuaSockets. We don’t have the ability to add in the new “unofficial” library and allow switching between the two libraries so I’m not sure what we can do about it. We will discuss it more today and I will let you know what we decide to do. [import]uid: 7559 topic_id: 33837 reply_id: 135752[/import]

@cjorgens79
Regarding your query “are there any other networking libraries that you work with Corona”…
Did you try Autolan?

We used it for the LAN connection of our multiplayer game, and it was pretty neat…
I do not know if the Luasockets bug affect their library though… You will haev to give it a try to find out!
And if you want multiplayer across the internet you should check out Noobhub [import]uid: 64174 topic_id: 33837 reply_id: 136096[/import]

@cjorgens79
Regarding your query “are there any other networking libraries that you work with Corona”…
Did you try Autolan?

We used it for the LAN connection of our multiplayer game, and it was pretty neat…
I do not know if the Luasockets bug affect their library though… You will haev to give it a try to find out!
And if you want multiplayer across the internet you should check out Noobhub [import]uid: 64174 topic_id: 33837 reply_id: 136097[/import]

Ok thanks for looking at it so quickly. I will wait to hear what you decide to do. [import]uid: 110197 topic_id: 33837 reply_id: 136073[/import]

@cjorgens79
Regarding your query “are there any other networking libraries that you work with Corona”…
Did you try Autolan?

We used it for the LAN connection of our multiplayer game, and it was pretty neat…
I do not know if the Luasockets bug affect their library though… You will haev to give it a try to find out!
And if you want multiplayer across the internet you should check out Noobhub [import]uid: 64174 topic_id: 33837 reply_id: 136096[/import]

@cjorgens79
Regarding your query “are there any other networking libraries that you work with Corona”…
Did you try Autolan?

We used it for the LAN connection of our multiplayer game, and it was pretty neat…
I do not know if the Luasockets bug affect their library though… You will haev to give it a try to find out!
And if you want multiplayer across the internet you should check out Noobhub [import]uid: 64174 topic_id: 33837 reply_id: 136097[/import]