Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
(0.10.5) Trouble with provided socketserver.lua & sockettest.lua
#1
Hello I have recently started messing around creating lua scripts and wanted to do some stuff with sockets and so tried the included scripts but anytime sockettest.lua connects it disconnects instantly.

Running sockettest without modification gives this output with the error on repeat:
Socket Test: Connecting to 127.0.0.1:8888...
Socket Test: Connected
Socket Test: Shutting down
Socket Test: Connecting to 127.0.0.1:8888...
[ERROR] D:/Emulation/mGBA/scripts/sockettest.lua:29: attempt to concatenate a table value (local 'err')

so i tried changing the error displaying in ST_error to this so i could get some info:
for i = 0, #err, 1
do
console:error(string.format("(Line %d) Socket Test Error: %s", i+1, err[i]))
end

Which gave me this output instead:
Socket Test: Connecting to 127.0.0.1:8888...
Socket Test: Connected
Socket Test: Shutting down
Socket Test: Connecting to 127.0.0.1:8888...
Socket Test: Connected
[ERROR] (Line 1) Socket Test Error: nil
Socket Test: Shutting down

For reference the output on socketserver.lua is this:
Socket Server Test: Listening on port 8888
Socket 1 Received: Connected
[ERROR] Socket 1 Error: disconnected
Socket 2 Received: Connected
Socket 2 Received: [ ]
[ERROR] Socket 2 Error: disconnected

I did try running the scripts on the dev build (0.11.0) and didn't have any such issues there, but I had problems with the emulator not responding when going to load a rom or script so idk lmao. Any help with this would be greatly appreciated ty <3
Reply

#2
I had the exact same issue with version 0.10.5 using those default scripts. Since it seems to work properly on the dev build, you might want to stick with that or check if there is an open bug report for the socket implementation in this release.
Reply

#3
Since the scripts work for you on 0.11.0 but not 0.10.5, it sounds like there may be a difference in how the socket API handles errors or disconnects between the versions. The attempt to concatenate a table value error also suggests err isn't a string in 0.10.5, so changing the error output alone probably won't fix the underlying issue. I'd check the return values from the socket read/receive calls in sockettest.lua and see what the server sends immediately after connecting. If possible, compare the relevant socket handling code in both versions. That should help narrow down whether this is a script compatibility issue or a bug in the older build.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2026 Melroy van den Berg.