diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-04 15:15:45 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-04 15:15:45 +0000 |
commit | 9ed7f955e5fc69af9bf1794fa2c8cd227981ba24 (patch) | |
tree | 8c3521366ef84f534bbec278437be7ea24e2ac1c /samples | |
parent | 63d60223da9de60f873ca08a25dbd9512c998929 (diff) | |
download | luasocket-9ed7f955e5fc69af9bf1794fa2c8cd227981ba24.tar.gz luasocket-9ed7f955e5fc69af9bf1794fa2c8cd227981ba24.tar.bz2 luasocket-9ed7f955e5fc69af9bf1794fa2c8cd227981ba24.zip |
Só pra não perder se der merda.
Diffstat (limited to 'samples')
-rw-r--r-- | samples/cddb.lua | 5 | ||||
-rw-r--r-- | samples/echoclnt.lua | 2 | ||||
-rw-r--r-- | samples/echosrvr.lua | 2 | ||||
-rw-r--r-- | samples/listener.lua | 2 |
4 files changed, 6 insertions, 5 deletions
diff --git a/samples/cddb.lua b/samples/cddb.lua index d2e5b59..0ceba09 100644 --- a/samples/cddb.lua +++ b/samples/cddb.lua | |||
@@ -1,4 +1,5 @@ | |||
1 | require"http" | 1 | socket = require("socket") |
2 | http = require("http") | ||
2 | 3 | ||
3 | if not arg or not arg[1] or not arg[2] then | 4 | if not arg or not arg[1] or not arg[2] then |
4 | print("luasocket cddb.lua <category> <disc-id> [<server>]") | 5 | print("luasocket cddb.lua <category> <disc-id> [<server>]") |
@@ -31,7 +32,7 @@ end | |||
31 | local host = socket.dns.gethostname() | 32 | local host = socket.dns.gethostname() |
32 | local query = "%s?cmd=cddb+read+%s+%s&hello=LuaSocket+%s+LuaSocket+2.0&proto=6" | 33 | local query = "%s?cmd=cddb+read+%s+%s&hello=LuaSocket+%s+LuaSocket+2.0&proto=6" |
33 | local url = string.format(query, server, arg[1], arg[2], host) | 34 | local url = string.format(query, server, arg[1], arg[2], host) |
34 | local body, headers, code, error = socket.http.get(url) | 35 | local body, headers, code, error = http.get(url) |
35 | 36 | ||
36 | if code == 200 then | 37 | if code == 200 then |
37 | local data, code, error = parse(body) | 38 | local data, code, error = parse(body) |
diff --git a/samples/echoclnt.lua b/samples/echoclnt.lua index 877e99b..038061d 100644 --- a/samples/echoclnt.lua +++ b/samples/echoclnt.lua | |||
@@ -4,7 +4,7 @@ | |||
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id$ | 5 | -- RCS ID: $Id$ |
6 | ----------------------------------------------------------------------------- | 6 | ----------------------------------------------------------------------------- |
7 | require"socket" | 7 | local socket = require("socket") |
8 | host = host or "localhost" | 8 | host = host or "localhost" |
9 | port = port or 7 | 9 | port = port or 7 |
10 | if arg then | 10 | if arg then |
diff --git a/samples/echosrvr.lua b/samples/echosrvr.lua index 79bff8f..73bf374 100644 --- a/samples/echosrvr.lua +++ b/samples/echosrvr.lua | |||
@@ -4,7 +4,7 @@ | |||
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id$ | 5 | -- RCS ID: $Id$ |
6 | ----------------------------------------------------------------------------- | 6 | ----------------------------------------------------------------------------- |
7 | require"socket" | 7 | socket = require("socket") |
8 | host = host or "127.0.0.1" | 8 | host = host or "127.0.0.1" |
9 | port = port or 7 | 9 | port = port or 7 |
10 | if arg then | 10 | if arg then |
diff --git a/samples/listener.lua b/samples/listener.lua index bedbde5..b2f7a7e 100644 --- a/samples/listener.lua +++ b/samples/listener.lua | |||
@@ -4,7 +4,7 @@ | |||
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id$ | 5 | -- RCS ID: $Id$ |
6 | ----------------------------------------------------------------------------- | 6 | ----------------------------------------------------------------------------- |
7 | require("socket") | 7 | local socket = require("socket") |
8 | host = host or "*" | 8 | host = host or "*" |
9 | port = port or 8080 | 9 | port = port or 8080 |
10 | if arg then | 10 | if arg then |