bnet.lua
http://pastebin.com/dBQF49RH
socket_wrapper.lua
http://pastebin.com/8WacRqCc
I'm supposed to have setup the Windows Sockets API properly, so I'd discard that option as a problem.
1
2
3
2
3
local ws = ffi.new("WSADATA") sock.WSAStartup(0x101, ws) ffi.C.atexit(sock.WSACleanup)
Every time I run the code, it gets stuck on the error given on getsockname (line 441 from bnet.lua), the given error results WSAEFAULT, I could discard that the problem is the "namelen" field because it's using the original size of the object SAddress (line 440 from bnet.lua). Considering that there were no errors when I had setup the socket and bound it, I assume that the problem has something to do with the object casted (line 438 and 439 from bnet.lua) which leaves me without ideas of what could be the actual problem. I tried to print these objects to see if they're null pointers, but they're not.
Has anyone worked with WinSock API before, or at least knows how to use LuaJIT's FFI module? I really appreciate your help if you do, I don't know anyone else who could solve this.