luasocket

Lua socket asynchronous calls

你。 提交于 2019-11-28 06:34:55
I am writing a program that uses Lua socket to communicate with a http server. The API that I am using is "socket.http.request", and I have found that it is synchronous. My understanding is that it waits until it gets some response or time outs. Is my understanding correct? If so, I'd prefer to use an asynchronous API. I also found another API "socket.http.request_cb", which calls a call back function when the request is processed. However, it doesn't seem to work here. (This API is not available on the version that I'm using.) I'm using Lua 5.1 and Lua socket 2.0.2 here. Could anyone let me

How to use Lua 5.2 with luasocket 3

﹥>﹥吖頭↗ 提交于 2019-11-28 00:29:40
问题 I am trying to compile luasocket 3 that I found on GitHub with lua 5.2. Problem is, I'm not sure how to bind together Lua with luasocket . Do I need to compile luasocket as DLL and then reference if somewhere in lua code, or should I just call it from lua console? 回答1: Try installing it using luarocks. If you don't have luarocks, install it following instructions on the site. Then download the rockspec file(luasocket-scm-0.rockspec) from luasocket repo and run $ luarocks install *path to the

luaSocket HTTP requests always respond with a redirect (301 or 302)

偶尔善良 提交于 2019-11-27 08:21:49
问题 I use LuaForWindows (latest version) and I have read this and this answer and everything i could find in the mailinglist of lua-users.org. What ever I try (most) sites only respond with either 301 or 302. I have created an example batch script which downloads (some) of the OpenGL 2.1 Reference from their man pages. @ECHO OFF FOR /F "SKIP=5" %%# IN ( %~fs0 ) DO lua -l socket.http -e "print(socket.http.request('https://www.opengl.org/sdk/docs/man2/xhtml/%%#.xml'))" GOTO:EOF glAccum