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
2
votes
1 answer

Compiling Luasocket

So I'm trying to use Luasocket with a third-party game that has a Lua API. It has support for packages but it says it needs some luasocket files I don't have (though it works outside of the IDE because I have Luasocket installed in the lua…
lordnoob
  • 190
  • 12
2
votes
1 answer

Strange bug involving string comparison in Lua

I am trying to create a program that scrapes images from the web in Lua. A minor problem is that images sometimes have no extension or incorrect extensions. See this animated "jpeg" for example: http://i.imgur.com/Imvmy6C.jpg So I created a function…
Houshalter
  • 2,508
  • 1
  • 18
  • 20
2
votes
2 answers

How to read E-Mails with Lua?

I am writing a script which can send E-Mails with LuaSocket SMTP. Now I would like to make my script also be able to read my E-Mails. I have an E-Mail account at a service which supports IMAP. IMAP host and port: example.com:143 My E-Mail:…
user3746280
2
votes
1 answer

lua socket handling multiple connections

my question is about lua sockets, say I have a chat and I want to make a bot for that chat. But the chat has multiple rooms all on defferent servers that are calculated by a function called getServer the connect function would look like…
user3103366
  • 65
  • 1
  • 9
2
votes
0 answers

Sending serialized images over network in Lua

I am developing a little game in lua (using love2D), and what I want to do is serialize an image in order to send it to another peer. So, I simple get the string description of the image file, then I write it on the socket. The problem is that…
Michele
  • 751
  • 1
  • 8
  • 16
2
votes
1 answer

Error in creating TCP client in lua

I am trying to create TCP client in lua local host, port = HOST, PORT local socket = require("socket") client = socket.tcp(); client:connect(host, port); client:send("Hello User"); this works fine but when i add while true do local s, status,…
Saurav
  • 248
  • 3
  • 13
2
votes
1 answer

What can I do to ensure delivery of messages over TCP using 'net' in nodejs?

I've got a very simple server created using nodejs with 'net' module. I also have a client which connects to it using luasockets. I was testing the connection for like 2 months now, using different connections like 3G, GPRS, WIFI and everything was…
Krystian
  • 3,193
  • 2
  • 33
  • 71
2
votes
2 answers

LuaSocket in Windows - How to install and use it in an Eclipse Project

When I run my code in terminal, local function main() local socket = require ("socket.http") end main() I get this error/message: module 'socket.http' not found: no field package.preload['socket.http'] no file…
AlexMJ
  • 89
  • 1
  • 9
2
votes
2 answers

Lua 5.2 adding luasocket (unstable)

Im trying to use luasocket with lua 5.2. i downloaded the code form the git repository and built it. then made a make install so that it generated core.dll and mime.dll. put those into the custom lua program directory [CPATH] im developing and tried…
alknows
  • 1,972
  • 3
  • 22
  • 26
2
votes
1 answer

How do I use luasocket from my VS C++ project, either find luasocket.h from LuaForWindows or build LuaSocket for Lua 5.2

I had installed Lua 5.1 using LuaForWindows, but I don't see luasocket.h in what was installed, so it appears I can't use that from my Visual Studio C++ project. So, I am trying to build and I got the latest version from github for Lua 5.2, even…
James Black
  • 41,583
  • 10
  • 86
  • 166
2
votes
1 answer

HTTP GET Chinese character using luasocket

I use luasocket to GET a web page which contains Chinese characters "开奖结果" (the page itself is encoded in charset="gb2312"), as below: require "socket" host = '61.129.89.226' fileformat =…
Baiyan Huang
  • 6,463
  • 8
  • 45
  • 72
2
votes
0 answers

How to know the client socket descriptor in Lua at the server end (HTTP server)

Is there a way to know the connected clients socket descriptor at the Server end while using on Lua enabled webservers(like Lighttpd,Apache)? I tested for getting the clients IP address and HTTP headers and am able to receive them properly. I could…
Sudhi
  • 21
  • 2
2
votes
2 answers

Luasocket custom headers, 404 turns to 301

My previous question was about fetching page title in lua using the socket.http module. The question lies here. Previously, youtube pages led me to a 404 error page. Based on MattJ's help, I put up custom HOST header for the request. This is what I…
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
1
vote
1 answer

Splitting a table in Lua

I have a script which gives me a table of timestamps and prices from a website API, I want to split them apart into timestamp and prices separately. My code to get the prices and timestamps local socket = require('socket.http') local requests =…
Joohane
  • 49
  • 1
  • 5
1
vote
1 answer

LUA error failed installing dependency (luasocket)

luasocket 3.0.0-1 depends on lua >= 5.1 (5.2-1 provided by VM) mingw32-gcc -O2 -c -o src/mime.o -IC:\lua src/mime.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 mingw32-gcc -O2 -c -o src/compat.o -IC:\lua src/compat.c -DLUASOCKET_DEBUG…
Joohane
  • 49
  • 1
  • 5