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

udp client sending ICMP "port unreachable" when receiveing messages from the server

Moved: https://superuser.com/questions/782549/udp-client-sending-icmp-port-unreachable-when-receiveing-messages-from-the-ser I have a udp client using luasocket, basically doing this (with a few layers of abstraction, but this is what's going on…
nonchip
  • 1,084
  • 1
  • 18
  • 36
5
votes
2 answers

Send Get to website with lua

i'm having a trouble with lua. I need send a request to a website by GET and get the response from website. Atm all i have is this: local LuaSocket = require("socket") client = LuaSocket.connect("example.com", 80) client:send("GET…
Gmlyra
  • 109
  • 1
  • 1
  • 6
5
votes
1 answer

Is there a luasocket library compatibile with lua 5.2.1?

Just like the title says, I need a luasocket library for Windows compatible with Lua 5.2.1.
Kurt Nauck
  • 339
  • 4
  • 15
5
votes
2 answers

How to download a file in Lua, but write to a local file as it works

I'm trying to make an updater so when my Lua application is out-of-date it will use LuaSocket to download the newer .exe file (which can run my Lua code). Inside this updater, I want it to show how much has been downloaded so far. However, with the…
Anonymous
  • 553
  • 5
  • 17
  • 41
5
votes
1 answer

Fetching page of url using luasocket and proxy

So far, I have the following piece: local socket = require "socket.http" client,r,c,h = socket.request{url = "http://example.com/", proxy=""} for i,v in pairs( c ) do print( i, v ) end which gives me an output like the…
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
4
votes
2 answers

add luasocket to program (bizhawk) shipped with own lua environment

I am trying to get luasocket working in the lua scripting environment of Bizhawk, but so far without luck. I downloaded the vc8 version of luasocket here, made sure I have vc8 installed, and checked the lua version that came with bizhawk: 5.1 But,…
Felk
  • 7,720
  • 2
  • 35
  • 65
4
votes
2 answers

LuaSocket to test presence of internet connection

I'm trying to test the presence of an internet connection in Corona SDK, using LuaSocket library. I found this solution: function test() local connection = socket.tcp() connection:settimeout(1000) local result =…
ProGM
  • 6,949
  • 4
  • 33
  • 52
4
votes
3 answers

How could I embedded socket in Lua internally, just like oslib, debuglib?

I want to implement the function like embedding the socket function in my Lua build. So I don't need to copy socket.core.dll any more (just for fun). I search the maillist, and see some guys discuss the…
sagasw
  • 133
  • 1
  • 7
4
votes
1 answer

Using bind() to create a server with Lua Socket

Working with LuaSocket, this code works: local socket = require'socket' local server = socket.bind('*',51423) local client = server:accept() but this code fails: local socket = require 'socket' local server =…
Phrogz
  • 296,393
  • 112
  • 651
  • 745
4
votes
2 answers

luasocket.c:20:17: error: lua.h: No such file or directory

I'm installing luasocket module for Lua, but I got the following error message: [root@localhost local]# wget http://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2/luasocket-2.0.2.tar.gz [root@localhost local]# tar zxvf…
Hunter Zhao
  • 4,589
  • 2
  • 25
  • 39
4
votes
1 answer

How do you install LuaSocket on Mac OS X

How do you install luasocket on the Mac OS X correctly? I have lua 5.1.4 installed as a binary in the /usr/bin on my Mac. I am needing guidance to configure and install luasocket. Please let me know if additional information is needed.
849486748
  • 103
  • 1
  • 5
4
votes
1 answer

Lua socket.http sink parameter

I'm trying to communicate with my servers from Lua to authenticate a user. This is what my request function looks like: function http.send(url) local req = require("socket.http") local b, c, h = req.request{ url = url, …
Anonymous
  • 553
  • 5
  • 17
  • 41
3
votes
2 answers

How to know if a value is a luasocket object?

I've noticed that luasocket doesn't seem to provide a way to know if a value is a luasocket object or not. The usual approach of comparing metatables doesn't work, as different socket object types have different metatables. There don't seem to be…
daurnimator
  • 4,091
  • 18
  • 34
3
votes
1 answer

PANIC: unprotected error in call to Lua API (undefined symbol: lua_gettop)

My environment is Lua-5.4.2 Luasocket-3.0-rc1. When I run lua script directly, it work success. When i run it through c language, it tell me error. Error Msg is : PANIC: unprotected error in call to Lua API (error running script: error loading…
Viper
  • 33
  • 2
3
votes
1 answer

Persistent socket connection in Lua/Python

I'm trying to create a persistent socket connection between a Lua client and Python server. Effectively a script that'll constantly ping the server with keepalive messages My current issue is that the socket closes after each connection without a…
Thomas R
  • 51
  • 4
1
2
3
11 12