Difference between revisions of "Lua Socket"
From GiderosMobile
(Created page with "__NOTOC__ <!-- GIDEROSOBJ:luasocket--> '''Supported platforms:''' File:Platform android.pngFile:Platform ios.pngFile:Platform mac.pngFile:Platform pc.pngFile...") |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
<!-- GIDEROSOBJ:luasocket--> | <!-- GIDEROSOBJ:luasocket--> | ||
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/> | '''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/> | ||
− | '''Available since:''' Gideros 2013. | + | '''Available since:''' Gideros 2013.7<br/> |
=== Description === | === Description === | ||
Line 8: | Line 8: | ||
For more info please see: '''https://w3.impa.br/~diego/software/luasocket/introduction.html''' | For more info please see: '''https://w3.impa.br/~diego/software/luasocket/introduction.html''' | ||
+ | |||
+ | And here: '''https://w3.impa.br/~diego/software/luasocket/socket.html''' | ||
To add Lua Socket support to your application you call: | To add Lua Socket support to your application you call: | ||
− | < | + | <syntaxhighlight lang="lua"> |
socket = require("socket.core") | socket = require("socket.core") | ||
− | </ | + | </syntaxhighlight> |
− | |||
− | |||
=== Example === | === Example === | ||
− | < | + | <syntaxhighlight lang="lua"> |
local socket = require("socket.core") | local socket = require("socket.core") | ||
client = socket.connect("google.com", 80) | client = socket.connect("google.com", 80) | ||
Line 30: | Line 30: | ||
end | end | ||
client:close() | client:close() | ||
− | </ | + | </syntaxhighlight> |
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === Methods '''TO DO''' | + | === Methods === |
− | <!--[[luamidi:base0]] ''sets that when sending messages the channels are in the range 0-15''<br/><!--GIDEROSMTD:luamidi:base0() sets that when sending messages the channels are in the range 0-15 | + | '''TO DO'''<br/> |
− | <!--[[luamidi:setQueueSizeLimit]] ''sets the Midi queue size limit''<br/><!--GIDEROSMTD:luamidi:setQueueSizeLimit() sets the Midi queue size limit | + | <!--[[luamidi:base0]] ''sets that when sending messages the channels are in the range 0-15''<br/>--><!--GIDEROSMTD:luamidi:base0() sets that when sending messages the channels are in the range 0-15--> |
+ | <!--[[luamidi:setQueueSizeLimit]] ''sets the Midi queue size limit''<br/>--><!--GIDEROSMTD:luamidi:setQueueSizeLimit() sets the Midi queue size limit--> | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| |
Latest revision as of 21:14, 13 December 2023
Supported platforms:
Available since: Gideros 2013.7
Description
LuaSocket is a Lua 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 the SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading files) protocols and other functionality commonly needed by applications that deal with the Internet.
For more info please see: https://w3.impa.br/~diego/software/luasocket/introduction.html
And here: https://w3.impa.br/~diego/software/luasocket/socket.html
To add Lua Socket support to your application you call:
socket = require("socket.core")
Example
local socket = require("socket.core")
client = socket.connect("google.com", 80)
client:send("GET /robots.txt HTTP/1.0\r\n\r\n")
while true do
s, status, partial = client:receive(1024)
print(s or partial)
if status == "closed" then
break
end
end
client:close()
MethodsTO DO |
EventsConstants |