mirror of
				https://github.com/lunarmodules/luasocket.git
				synced 2025-10-31 18:35:45 +01:00 
			
		
		
		
	Spell checking on the manuals.
David's changes to lp.lua.
This commit is contained in:
		| @@ -122,7 +122,7 @@ message. | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:56:09 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </center> | ||||
|   | ||||
| @@ -279,7 +279,7 @@ f, e = ftp.put{ | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:56:32 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </center> | ||||
|   | ||||
| @@ -315,7 +315,7 @@ r, c = http.request { | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:57:03 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </center> | ||||
|   | ||||
| @@ -101,7 +101,7 @@ contains several examples, this user's manual and basic test procedures. | ||||
| </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  | ||||
| <a href=http://luaforge.net/projects/luabinaries>LuaBinaries</a>  | ||||
| available from LuaForge.  | ||||
| @@ -246,7 +246,7 @@ still available for those that have compatibility issues. | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:56:56 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </center> | ||||
|   | ||||
| @@ -37,7 +37,7 @@ Installation"> | ||||
|  | ||||
| <!-- installation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||||
|  | ||||
| <h2>Instalation</h2> | ||||
| <h2>Installation</h2> | ||||
|  | ||||
| <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 | ||||
| @@ -48,7 +48,7 @@ standardization and flexibility of the standard. | ||||
| <p>  | ||||
| The proposal was considered important enough by some of us to justify  | ||||
| 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>  | ||||
| has been released in conjunction with Roberto Ierusalimschy and <a | ||||
| href=http://www.keplerproject.org/>The Kepler Project</a> team.  | ||||
| @@ -110,7 +110,7 @@ LUA_PATH=<SHARE>/?.lua;?.lua | ||||
| LUA_CPATH=<LIB>/?.dll;?.dll | ||||
| </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> | ||||
|  | ||||
| <h3>Using LuaSocket</h3> | ||||
| @@ -127,13 +127,12 @@ Lua 5.0.2  Copyright (C) 1994-2004 Tecgraf, PUC-Rio | ||||
| </pre> | ||||
|  | ||||
| <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> | ||||
| Lua 5.0.2  Copyright (C) 1994-2004 Tecgraf, PUC-Rio | ||||
| > 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 | ||||
| </pre> | ||||
|  | ||||
| @@ -152,7 +151,7 @@ print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket")) | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:57:22 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </center> | ||||
|   | ||||
| @@ -323,7 +323,7 @@ and many others are covered by the <a href=reference.html>reference manual</a>. | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:57:43 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </center> | ||||
|   | ||||
| @@ -420,7 +420,7 @@ Creates and returns a source that produces the contents of a | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:57:47 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </center> | ||||
|   | ||||
| @@ -466,7 +466,7 @@ marker. | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:57:51 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </center> | ||||
|   | ||||
| @@ -229,7 +229,7 @@ Support, Manual"> | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:57:56 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </center> | ||||
|   | ||||
| @@ -407,7 +407,7 @@ r, e = smtp.send{ | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:58:01 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </center> | ||||
|   | ||||
| @@ -230,7 +230,7 @@ sink from a stream socket object. | ||||
| </p> | ||||
|  | ||||
| <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: | ||||
| </p> | ||||
| <ul> | ||||
| @@ -395,7 +395,7 @@ This constant has a string describing the current LuaSocket version. | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:58:06 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </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 | ||||
| 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 | ||||
| stablished. | ||||
| established. | ||||
| </p> | ||||
|  | ||||
| <!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||||
| @@ -539,7 +539,7 @@ This function returns 1. | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:58:10 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </center> | ||||
|   | ||||
| @@ -406,7 +406,7 @@ imperative nature obvious. | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:58:15 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </center> | ||||
|   | ||||
| @@ -319,7 +319,7 @@ The function returns the decoded string. | ||||
| <p> | ||||
| <small> | ||||
| Last modified by Diego Nehab on <br> | ||||
| Sun Nov 28 03:19:00 EST 2004 | ||||
| Mon Nov 21 01:58:20 EST 2005 | ||||
| </small> | ||||
| </p> | ||||
| </center> | ||||
|   | ||||
							
								
								
									
										16
									
								
								etc/lp.lua
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								etc/lp.lua
									
									
									
									
									
								
							| @@ -11,6 +11,8 @@ | ||||
| -- make sure LuaSocket is loaded | ||||
| local io = require("io") | ||||
| local base = _G | ||||
| local os = require("os") | ||||
| local math = require("math") | ||||
| local string = require("string") | ||||
| local socket = require("socket") | ||||
| local ltn12 = require("ltn12") | ||||
| @@ -192,6 +194,7 @@ local function send_data(con,fh,size) | ||||
|       con.try(size == 0, "file size mismatch") | ||||
|     end | ||||
|   end | ||||
|   recv_ack(con) -- note the double acknowledgement | ||||
|   send_ack(con) | ||||
|   recv_ack(con) | ||||
|   return size | ||||
| @@ -224,7 +227,7 @@ local control_dflt = { | ||||
| local seq = 0 | ||||
| local function newjob(connection) | ||||
|     seq = seq + 1 | ||||
|     return math.floor(socket.gettime() * 1000 + seq) | ||||
|     return math.floor(socket.gettime() * 1000 + seq)%1000 | ||||
| end | ||||
|  | ||||
|  | ||||
| @@ -241,14 +244,16 @@ local format_codes = { | ||||
|   f = 'f' | ||||
| } | ||||
|  | ||||
| -- lp.send | ||||
| -- lp.send{option} | ||||
| -- requires option.file | ||||
|  | ||||
| send = socket.protect(function(file, option) | ||||
|   socket.try(file, "invalid file name") | ||||
| send = socket.protect(function(option) | ||||
|   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 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 | ||||
|   local localhost = socket.dns.gethostname() or os.getenv("COMPUTERNAME") | ||||
|     or "localhost" | ||||
|   local con = connect(localhost, option) | ||||
| @@ -317,4 +322,3 @@ query = socket.protect(function(p) | ||||
|   con.skt:close() | ||||
|   return data | ||||
| end) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user