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

luasocket send UDP data from port 1900

I am trying to Emulate Belkin wemo switch from my Home automation controller to send voice command from amazon Echo.The controller supports lua language. I am following up this file to send the UDP data from port 1900 of Controller to port 50000 of…
Prakash.DTI
  • 913
  • 2
  • 9
  • 19
3
votes
2 answers

'SIGPIPE': undeclared identifier in luasocket-2.0.2

I am trying to compile luasocket-2.0.2 (or: luasocket) but as I try to do so, some macros appear to be undefined. Namely: identifier "SIGPIPE" is undefined identifier "F_GETFL" is undefined identifier "O_NONBLOCK" is undefined identifier "F_SETFL"…
Stefan Falk
  • 23,898
  • 50
  • 191
  • 378
3
votes
2 answers

Convert Binary Data to Torch Tensor in Lua

I have Lua code that downloads an image from a url using a luasocket: local http = require('socket.http') local image = require('image') image_url = 'https://www.somedomain.com/someimage.jpg' local body, code = http.request(image_url) -- body has…
siavashk
  • 436
  • 7
  • 24
3
votes
1 answer

Download file by url in lua

Lua beginner here. :) I am trying to load a file by url and somehow I am just too stupid to get all the code samples here on SO to work for me. How to download a file in Lua, but write to a local file as it works downloading and storing files from…
sceiler
  • 1,145
  • 2
  • 20
  • 35
3
votes
2 answers

installing lua socket lib

I am trying to install luasocket, but it I can't find any info how to do this. I downloaded from luaforge luasocket-2.0.2.tar.gz archive, but there is no configure file, only MVS solutions. So, how to get compiled libs?
Lobster
  • 635
  • 2
  • 12
  • 30
3
votes
1 answer

LuaSocket (UDP) not receiving datagrams

I'm experimenting with LuaSocket for a project I'm working on. I've chosen UDP as my protocol. Looking for docs and tutorials online, I've attempted to create a client-server pair for testing and learning. According to what I've read, the following…
account3r2
  • 43
  • 1
  • 5
3
votes
1 answer

Download large file with LuaSocket's HTTP module while keeping UI responsive

I would like to use LuaSocket's HTTP module to download a large file while displaying progress in the console and later on in a GUI. The UI must never block, not even when the server is unresponsive during the transfer. Additionally, creating a…
user1973386
  • 1,095
  • 2
  • 10
  • 18
3
votes
1 answer

luasocket 3.0,undefined symbol:lua_callk

I'm using luajit 2.0.3,and I want to use luasocket in myproject.When require socket in jit, it reported an error "error loading module 'socket.core' from file '/usr/local/lib/lua/5.1/socket/core.so': /usr/local/lib/lua/5.1/socket/core.so: undefined…
JoeyMiu
  • 139
  • 10
3
votes
3 answers

LuaSocket FTP always times out

I've had success with LuaSocket's TCP facility, but I'm having trouble with its FTP module. I always get a timeout when trying to retrieve a (small) file. I can download the file just fine using Firefox or ftp in passive mode (on Ubuntu Dapper…
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
3
votes
1 answer

Lua Socket cannot be properly stopped by Ctrl+C

I have a standalone lua script that uses lua sockets to connect to a server via TCP IP. It uses receive call to receive data from that server. It works, however, when I try to stop it with Ctrl+C, one of the two scenarios is happening: -If there…
elanamig
  • 359
  • 3
  • 6
  • 14
3
votes
1 answer

Lua HTTP download and save to file

I'm trying to download and then save the contents to a xml file. The code I got is: local filePath = currentDir().."/file.xml" local http = require("socket.http") local xFile = io.open(filePath, "w") local save =…
user2779657
  • 99
  • 2
  • 7
3
votes
1 answer

Read lua interface

In lua, is there any way to read an interface file to extract name/methods/args? I have an .idl file like this: interface { name = myInterface, methods = { testing = { resulttype = "double", args = {{direction…
briba
  • 2,857
  • 2
  • 31
  • 59
3
votes
3 answers

How do i use socket.select?

I need some help using socket "select" function. My server code is like this: while true do for _,server in pairs(servers) do local client = server:accept() client:settimeout(5) local line, err = client:receive() …
briba
  • 2,857
  • 2
  • 31
  • 59
3
votes
2 answers

In Luasocket, under which conditions can an accept call block even after select tells it is safe to read?

The Luasocket select function is supposed to tell when a socket can be read without blocking. It apparently can also be used to tell when a server socket is ready to accept a new connection however the documentation gives the following…
hugomg
  • 68,213
  • 24
  • 160
  • 246
3
votes
1 answer

Lua Socket: How to send asynchronous http.request?

Possible Duplicate: Lua socket asynchronous calls I think my question is pretty clear. So, how?
Luaox
  • 167
  • 1
  • 3
  • 13
1 2
3
11 12