love.js icon indicating copy to clipboard operation
love.js copied to clipboard

socket and enet not working

Open josefnpat opened this issue 8 years ago • 2 comments

Any chance we could get enet and socket working?

My game, xapalus, uses both socket and enet.

I get the following errors when launching the game, and then attempting to connect to a localhost server.

http request error  timeout
bad ioctl syscall 21537
abort("bad ioctl syscall 21537") at jsStackTrace@http://localhost:8000/love.js:1060:13
stackTrace@http://localhost:8000/love.js:1077:22
abort@http://localhost:8000/love.js:959056:44
___syscall54@http://localhost:8000/love.js:6906:18
_ioctl@http://localhost:8000/love.js:882537:8
_enet_socket_set_option@http://localhost:8000/love.js:45627:9
_enet_host_create@http://localhost:8000/love.js:34942:5
__ZL11host_createP9lua_State@http://localhost:8000/love.js:31708:9
_luaD_precall@http://localhost:8000/love.js:431099:11
_luaV_execute@http://localhost:8000/love.js:448739:16
_luaD_call@http://localhost:8000/love.js:431843:3
_f_call@http://localhost:8000/love.js:427615:2
dynCall_vii@http://localhost:8000/love.js:940448:3
invoke_vii@http://localhost:8000/love.js:13576:5
_luaD_rawrunprotected@http://localhost:8000/love.js:430522:3
_luaD_pcall@http://localhost:8000/love.js:432141:9
_lua_pcall@http://localhost:8000/love.js:427590:9
__ZZ4mainEN3__08__invokeEPv@http://localhost:8000/love.js:14728:8
dynCall_vi@http://localhost:8000/love.js:940588:3
Runtime.dynCall@http://localhost:8000/love.js:327:14
Browser_mainLoop_runner/<@http://localhost:8000/love.js:2962:13
Browser.mainLoop.runIter@http://localhost:8000/love.js:3026:13
Browser_mainLoop_runner@http://localhost:8000/love.js:2960:9

Error: [string "boot.lua"]:229: Already initialized
stack traceback:
    [C]: in function 'init'
    [string "boot.lua"]:229: in function <[string "boot.lua"]:223>
    [C]: in function 'xpcall'
Assertion failed: emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.

josefnpat avatar Feb 14 '16 21:02 josefnpat

enet can work in emscripten-ported projects, for example Cube 2 uses it and it was ported in BananaBread. However,

  1. You can only use non-blocking sockets (as web sockets do not block), which might be the issue with that stack trace (the code is for FIONBIO which relates to blocking IO).
  2. On the web, you can only use websockets (or WebRTC), which are not normal TCP or UDP sockets, so this requires a different server than the native enet one.

kripken avatar Feb 14 '16 22:02 kripken

Any news on this? I would love some explanations on how to get sockets to work with love.js. Thank you!

Ulydev avatar Jan 18 '17 16:01 Ulydev