Questions tagged [luasocket]

LuaSocket is a Lua extension library that helps to add support for functionality commonly needed by applications that deal with the Internet. It provides easy access to TCP, UDP, DNS, SMTP, FTP, HTTP, MIME and more.

LuaSocket is a extension library that is composed by two parts: a C core that provides support for the TCP and UDP transport layers, and a set of Lua modules that add support for functionality commonly needed by applications that deal with the Internet.

Author: Diego Nehab

The core support has been implemented so that it is both efficient and simple to use. It is available to any Lua application once it has been properly initialized by the interpreter in use. The code has been tested and runs well on several Windows and Unix platforms.

Among the support modules, the most commonly used implement the SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading files) client protocols. These provide a very natural and generic interface to the functionality defined by each protocol. In addition, you will find that the MIME (common encodings), URL (anything you could possible want to do with one) and LTN12 (filters, sinks, sources and pumps) modules can be very handy.

Useful Links

178 questions
1
vote
2 answers

How to get Client IP in Lua Sockets

I'm having trouble locating how I go about getting the ip address of each client as they connect to my server, using LuaSockets; Also: I apologise if this has been answered in another post, but I could find it; Link me if this is the case. Cheers!
Shane Gadsby
  • 1,260
  • 1
  • 13
  • 19
1
vote
0 answers

Luasocket closed unexpectedly after receiving large amount of packets

I'm using luasocket tcp to receive data in non-blocking mode periodically, (settimeout(0)), after receiving large amount of packets in a very small interval, the conn:receive(2048, part) emmit a 'closed' error. Strangely, when I set the timeout to…
poe poe
  • 11
  • 1
1
vote
0 answers

Lua - Obtain my local/external IP and my VPN tunnelled external IP via an HTTP Proxy

I have a VPN Docker container set up using Gluetun, which is running an HTTP Proxy, I’m trying to see if it’s possible to do a Lua http.request to retrieve both my direct (local) external IP, AND my tunnelled external IP too? I’ve found a few pages…
nodecentral
  • 446
  • 3
  • 16
1
vote
1 answer

Not able to install LuaSocket from LuaRocks on Windows

I installed the LuaRocks legacy package which includes Lua 5.1 on Windows. But when I run luarocks install luasocket, I get the following output: Installing https://luarocks.org/luasocket-3.0rc1-2.src.rock luasocket 3.0rc1-2 depends on lua >= 5.1…
Anon
  • 116
  • 2
  • 6
1
vote
3 answers

How to install modules to Luajit using Luarocks

I managed to install luasocket and works fine using lua5.3 but i can't find the way to install them to require from luajit. If i write print(_VERSION) it shows luajit use lua5.1. This is the stuff i been trying: luarocks install luasocket luarocks…
String Manolo
  • 35
  • 2
  • 8
1
vote
2 answers

How to detect and quick a lua function taking too long to respond?

I'm using Corona SDK to make a simple app that requires luasocket. Corona SDK support luasocket to do async http req. But I want to use UDP from luasocket. UDP receive() method from luasocket is blocking until it receives a message. Corona SDK…
astk
  • 225
  • 2
  • 7
1
vote
1 answer

Traversing Google searches using LuaSocket

I am trying to make a Lua program that creates a google search, and formats all of the results in a different arrangement. The only problem is that I cannot find a way to do these: get the html of the search results search through all of the…
user809559
  • 81
  • 1
  • 5
1
vote
1 answer

Conflicting types for inet_ntop

I am trying to compile luasocket with Msys2 mingw32. When I run make I get this error message: src\inet.h:48:13: error: conflicting types for 'inet_ntop' 48 | const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt); | …
Milind
  • 415
  • 8
  • 24
1
vote
2 answers

Lua http socket evaluation

I use lua 5.1 and the luaSocket 2.0.2-4 to retrieve a page from a web server. I first check if the server is responding and then assign the web server response to lua variables. local mysocket = require("socket.http") if mysocket.request(URL) == nil…
ripat
  • 3,076
  • 6
  • 26
  • 38
1
vote
1 answer

lua 5.3.5 + luasocket 3.0-rc1 + luasec 0.8 : WIN32 DLL with multiple luaopen_xxx_xxx exported function names

I am using Embarcadero C++Builder 10.1 32 bit on a Windows 7 64 bit computer. I am compiling everything with the CB10.1 32 bit free version of the Embarcadero IDE. I have compiled lua 5.3.5 to a dll. Then I compiled lua.c into a DOS executable…
1
vote
2 answers

How to send compressed data using UDP or TCP (lua / java)

I am making a server with lua clients and Java server. I need some data to be compressed in order to reduce the data flow. In order to do this I use LibDeflate for compressing the data on the client side local config = {level = 1} local compressed…
jojos38
  • 45
  • 1
  • 6
1
vote
1 answer

LuaRocks LuaSocket failed install

Disclaimer: There is a similar question on here by a different user, but it was never answered. Maybe this time will be different. I'm attempting to install Copas, but one of the dependencies is LuaSocket. However, when I try to install LuaSocket, I…
Josh
  • 3,225
  • 7
  • 30
  • 44
1
vote
2 answers

How can a LuaSocket server handle several requests simultaneously?

The problem is the inability of my Lua server to accept multiple request simultaneously. I attempted to make each client message be processed in its on coroutine, but this seems to have failed. while true do local client =…
BlueShamen
  • 67
  • 7
1
vote
0 answers

LuaSocket not receiving messages from UDPSocket in Ruby

I'm trying to connect a Windows computer game which uses Lua to external server written in Ruby and hosted on my Macbook on the same network. This is Lua code executed at the beginning in-game socket = require("socket") udp =…
Patryk
  • 197
  • 1
  • 16
1
vote
1 answer

Luasec Luasocket https.request with user agent and return body

I want to make a https.request with a custom user-agent using LuaSec. I've tried the method described here: https://github.com/brunoos/luasec/wiki/LuaSec-0.4#httpsrequesturl---body But I don't know how to pass http headers to this function with…
Oxy Synth
  • 154
  • 2
  • 11