mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 12:28:21 +01:00
Spell checking on the manuals.
David's changes to lp.lua.
This commit is contained in:
parent
71f483496d
commit
a2b780bf7a
@ -122,7 +122,7 @@ message.
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:56:09 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -279,7 +279,7 @@ f, e = ftp.put{
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:56:32 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -315,7 +315,7 @@ r, c = http.request {
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:57:03 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -101,7 +101,7 @@ contains several examples, this user's manual and basic test procedures.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Danilo Tuler is mantaining Win32 binaries for LuaSocket, which are also
|
Danilo Tuler is maintaining Win32 binaries for LuaSocket, which are also
|
||||||
available from LuaForge. These are compatible with the
|
available from LuaForge. These are compatible with the
|
||||||
<a href=http://luaforge.net/projects/luabinaries>LuaBinaries</a>
|
<a href=http://luaforge.net/projects/luabinaries>LuaBinaries</a>
|
||||||
available from LuaForge.
|
available from LuaForge.
|
||||||
@ -246,7 +246,7 @@ still available for those that have compatibility issues.
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:56:56 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -37,7 +37,7 @@ Installation">
|
|||||||
|
|
||||||
<!-- installation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
<!-- installation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
<h2>Instalation</h2>
|
<h2>Installation</h2>
|
||||||
|
|
||||||
<p> LuaSocket 2.0 uses the new package proposal for Lua 5.1.
|
<p> LuaSocket 2.0 uses the new package proposal for Lua 5.1.
|
||||||
All Lua library developers are encouraged to update their libraries so that
|
All Lua library developers are encouraged to update their libraries so that
|
||||||
@ -48,7 +48,7 @@ standardization and flexibility of the standard.
|
|||||||
<p>
|
<p>
|
||||||
The proposal was considered important enough by some of us to justify
|
The proposal was considered important enough by some of us to justify
|
||||||
early adoption, even before release of Lua 5.1.
|
early adoption, even before release of Lua 5.1.
|
||||||
Thus, a compability module
|
Thus, a compatibility module
|
||||||
<a href=http://www.keplerproject.org/compat/>compat-5.1</a>
|
<a href=http://www.keplerproject.org/compat/>compat-5.1</a>
|
||||||
has been released in conjunction with Roberto Ierusalimschy and <a
|
has been released in conjunction with Roberto Ierusalimschy and <a
|
||||||
href=http://www.keplerproject.org/>The Kepler Project</a> team.
|
href=http://www.keplerproject.org/>The Kepler Project</a> team.
|
||||||
@ -110,7 +110,7 @@ LUA_PATH=<SHARE>/?.lua;?.lua
|
|||||||
LUA_CPATH=<LIB>/?.dll;?.dll
|
LUA_CPATH=<LIB>/?.dll;?.dll
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p> Again, naturally, on Unix systmems the shared library extension would be
|
<p> Again, naturally, on Unix systems the shared library extension would be
|
||||||
<tt>.so</tt> instead of <tt>.dll</tt>.</p>
|
<tt>.so</tt> instead of <tt>.dll</tt>.</p>
|
||||||
|
|
||||||
<h3>Using LuaSocket</h3>
|
<h3>Using LuaSocket</h3>
|
||||||
@ -127,13 +127,12 @@ Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p> Each module loads their dependencies automatically, so you only need to
|
<p> Each module loads their dependencies automatically, so you only need to
|
||||||
load the modues you directly depend upon: <p>
|
load the modules you directly depend upon: </p>
|
||||||
|
|
||||||
<pre class=example>
|
<pre class=example>
|
||||||
Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio
|
Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio
|
||||||
> http = require("socket.http")
|
> http = require("socket.http")
|
||||||
>
|
> print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket"))
|
||||||
print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket"))
|
|
||||||
--> homepage gets dumped to terminal
|
--> homepage gets dumped to terminal
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@ -152,7 +151,7 @@ print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket"))
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:57:22 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -323,7 +323,7 @@ and many others are covered by the <a href=reference.html>reference manual</a>.
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:57:43 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -420,7 +420,7 @@ Creates and returns a source that produces the contents of a
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:57:47 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -466,7 +466,7 @@ marker.
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:57:51 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -229,7 +229,7 @@ Support, Manual">
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:57:56 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -407,7 +407,7 @@ r, e = smtp.send{
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:58:01 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -230,7 +230,7 @@ sink from a stream socket object.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class=parameters>
|
<p class=parameters>
|
||||||
<tt>Mode</tt> defines the behaviour of the sink. The following
|
<tt>Mode</tt> defines the behavior of the sink. The following
|
||||||
options are available:
|
options are available:
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
@ -395,7 +395,7 @@ This constant has a string describing the current LuaSocket version.
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:58:06 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -177,7 +177,7 @@ method affects the behavior of <tt>connect</tt>, causing it to return
|
|||||||
with an error in case of a timeout. If that happens, you can still call <a
|
with an error in case of a timeout. If that happens, you can still call <a
|
||||||
href=socket.html#select><tt>socket.select</tt></a> with the socket in the
|
href=socket.html#select><tt>socket.select</tt></a> with the socket in the
|
||||||
<tt>sendt</tt> table. The socket will be writable when the connection is
|
<tt>sendt</tt> table. The socket will be writable when the connection is
|
||||||
stablished.
|
established.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
<!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
@ -539,7 +539,7 @@ This function returns 1.
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:58:10 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -406,7 +406,7 @@ imperative nature obvious.
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:58:15 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
@ -319,7 +319,7 @@ The function returns the decoded string.
|
|||||||
<p>
|
<p>
|
||||||
<small>
|
<small>
|
||||||
Last modified by Diego Nehab on <br>
|
Last modified by Diego Nehab on <br>
|
||||||
Sun Nov 28 03:19:00 EST 2004
|
Mon Nov 21 01:58:20 EST 2005
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</center>
|
</center>
|
||||||
|
14
etc/lp.lua
14
etc/lp.lua
@ -11,6 +11,8 @@
|
|||||||
-- make sure LuaSocket is loaded
|
-- make sure LuaSocket is loaded
|
||||||
local io = require("io")
|
local io = require("io")
|
||||||
local base = _G
|
local base = _G
|
||||||
|
local os = require("os")
|
||||||
|
local math = require("math")
|
||||||
local string = require("string")
|
local string = require("string")
|
||||||
local socket = require("socket")
|
local socket = require("socket")
|
||||||
local ltn12 = require("ltn12")
|
local ltn12 = require("ltn12")
|
||||||
@ -192,6 +194,7 @@ local function send_data(con,fh,size)
|
|||||||
con.try(size == 0, "file size mismatch")
|
con.try(size == 0, "file size mismatch")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
recv_ack(con) -- note the double acknowledgement
|
||||||
send_ack(con)
|
send_ack(con)
|
||||||
recv_ack(con)
|
recv_ack(con)
|
||||||
return size
|
return size
|
||||||
@ -224,7 +227,7 @@ local control_dflt = {
|
|||||||
local seq = 0
|
local seq = 0
|
||||||
local function newjob(connection)
|
local function newjob(connection)
|
||||||
seq = seq + 1
|
seq = seq + 1
|
||||||
return math.floor(socket.gettime() * 1000 + seq)
|
return math.floor(socket.gettime() * 1000 + seq)%1000
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -241,11 +244,13 @@ local format_codes = {
|
|||||||
f = 'f'
|
f = 'f'
|
||||||
}
|
}
|
||||||
|
|
||||||
-- lp.send
|
-- lp.send{option}
|
||||||
|
-- requires option.file
|
||||||
|
|
||||||
send = socket.protect(function(file, option)
|
send = socket.protect(function(option)
|
||||||
socket.try(file, "invalid file name")
|
|
||||||
socket.try(option and base.type(option) == "table", "invalid options")
|
socket.try(option and base.type(option) == "table", "invalid options")
|
||||||
|
local file = option.file
|
||||||
|
socket.try(file, "invalid file name")
|
||||||
local fh = socket.try(io.open(file,"rb"))
|
local fh = socket.try(io.open(file,"rb"))
|
||||||
local datafile_size = fh:seek("end") -- get total size
|
local datafile_size = fh:seek("end") -- get total size
|
||||||
fh:seek("set") -- go back to start of file
|
fh:seek("set") -- go back to start of file
|
||||||
@ -317,4 +322,3 @@ query = socket.protect(function(p)
|
|||||||
con.skt:close()
|
con.skt:close()
|
||||||
return data
|
return data
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user