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

Corona SDK and Lua Socket blocks animation

Here is my network handler: https://gist.github.com/anonymous/22fc110ad126ef3a2c5f The problem is that when data is received it blocks my animiation (I have a wheel spinning when data has been requested) so it looks like the app have crashed and…
Westerlund.io
  • 2,743
  • 5
  • 30
  • 37
1
vote
2 answers

Lua HTTP Request Timeout Hang

I have inherited some Lua code that communicates with a server via HTTP Request/Response. This has been running in the field for several years but I recently noticed some hangs in the timeout of the HTTP requests from the system. Each individual…
linsek
  • 3,334
  • 9
  • 42
  • 55
1
vote
1 answer

Lua import library from local path (luasocket)

I'm quite new to Lua and I have some problems with the import mechanism. From other languages I'm used to do something like this: include "./lib/mylib.h" or in general just to pass the local path to the file I would like to include. Now in Lua it…
TorbenJ
  • 4,462
  • 11
  • 47
  • 84
1
vote
1 answer

Lua https timeout is not working

I am using following versions of Lua and it's packets on openWRT environment: luasocket-2.0.2 luasec-0.4 lua-5.1.4 Trying to use timeout for a https.request call. Tried using https.TIMEOUT where local https = require("ssl.https") and it never time…
1
vote
2 answers

Lua socket.http loads fine from example script, but does not load from third party host

I'm working on a Lua script which will be hosted by a third party program (some .exe which will call a certain function in my script). In order to implement a functionality I need (make a rest call to a webservice to retrieve certain info) I want to…
Jonathan van de Veen
  • 1,016
  • 13
  • 27
1
vote
2 answers

Lua sockets: can't get it to connect and send data

This is my first time messing with sockets in Lua. No matter what I try I can't get it to connect. Is there something I did wrong or did not do? --will store room sockets Rsock = {} --will store pm sockets Psock = {} --will sore the…
user2763567
1
vote
2 answers

Luasocket TCP stops listening after \r\n\r\n

Whenever I receive TCP messages using something like this: local socket=require "socket" local sv=socket.bind("*",1337) function love.update(dt) local s=sv:accept() while true do local s,e=s:receive() print(e or s) …
PixelToast
  • 915
  • 6
  • 10
1
vote
1 answer

LuaSocket smtp connection refused

I am wanting to send an email to a gmail account from lua using the socket library. smtp = require("socket.smtp") address = { "" } from = { "" } theMessage = { headers = { to = "YOU", cc = '"him" ', …
user1709076
  • 2,538
  • 9
  • 38
  • 59
1
vote
2 answers

lua socket receive reports same data multiple times

I have the following code which sits inside a loop (Simplified). cscc is a client socket connecting to a server on localhost. My server sends a single character to the client. However, I don't seem to be receiving it properly. Protocol is TCP. …
nakiya
  • 14,063
  • 21
  • 79
  • 118
1
vote
1 answer

Luasocket server and actionscript

I used an example given on the Luasocket website just to try it out, my goal was to make a flash game that'll communicate with the socket. I run the server and connected to it using telnet at first and it worked, every message I sent appeared on the…
Radicate
  • 2,934
  • 6
  • 26
  • 35
1
vote
2 answers

SHOUTcast fetch request denied every time with 404

Code function radiotest(host,port) local rstr="Online" local sock, err = socket.tcp() if not sock then return "Failed" end sock:settimeout(1) local res, err = sock:connect(host, port) if not res then …
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
1
vote
3 answers

Moai: Graphics that reacts to commands via Sockets

I need a program that can create pre-defined shapes on screen according to that commands I send to it via TCP. I'm trying to listen to a port and so that I can use them. Before waiting of a command (via network) I have the commands required to…
Ansel Zandegran
  • 636
  • 8
  • 18
1
vote
1 answer

LuaSocket : What does unconnected:sendto function return?

The docs say If successful, the method returns 1. In case of error, the method returns nil followed by an error message. I get a return value of 5. Even when nil is returned, no error message is returned... What does "5" return value mean? No.…
SatheeshJM
  • 3,575
  • 8
  • 37
  • 60
1
vote
0 answers

luasoket http request got "connection refused"

I am trying to use luasocket to make http "GET" request to "https://buy.itunes.apple.com/verifyReceipt" , it yields a "connection refused" , while I can access this URL from the the web browser either use python httplib. I doubted it is because…
mebusy
  • 21
  • 4
1
vote
1 answer

LuaSocket - attempt to call field 'try' (a nil value)

Platform: (where Lua and LuaSocket are ported) An embedded system using ARM 7 development board running 3rd party RTOS with TCP/IP stack. What works: Using Lua standard library such as "io" calls, print, assert, etc sending UDP packets by using…
user1325966
  • 33
  • 1
  • 5