Releasing 2.0 alpha!!!

This commit is contained in:
Diego Nehab 2003-06-30 18:53:10 +00:00
parent 167727be3c
commit a581d2333b
5 changed files with 74 additions and 76 deletions

25
NEW
View File

@ -1,17 +1,21 @@
All functions provided by the library are in the namespace "socket". Major C code rewrite. Code is modular and extensible. Hopefully, next
Functions such as send/receive/timeout/close etc do not exist in the versions will include code for local domain sockets, file descriptors,
namespace. They are now only available as methods of the appropriate pipes (on unix) and named pipes (on windows) as a bonus.
objects.
Object has been changed to become more uniform. First create an object for All functions provided by the library are in the namespace "socket".
a given domain/family and protocol. Then connect or bind if needed. Then Functions such as send/receive/timeout/close etc do not exist anymore as
use IO functions. stand alone functions. They are now only available as methods of the
appropriate objects.
TCP has been changed to become more uniform. First create an object, then
connect or bind if needed. Then use IO functions. The "socket.connect" and
"socket.bind" functions are provided for simplicity, but they just call
"socket.tcp" followed by the ":connect" or ":bind" methods.
All functions return a non-nil value as first return value if successful. All functions return a non-nil value as first return value if successful.
All functions return whatever could be retrieved followed by error message All functions return whatever could be retrieved followed by error message
in case of error. The best way to check for errors is to check for the in case of error. The best way to check for errors is to check for the
presence of an error message. presence of an error message. WARNING: The send function was affected.
WARNING: The send function was affected.
Better error messages and parameter checking. Better error messages and parameter checking.
@ -20,3 +24,6 @@ setpeername with address "*".
socket.sleep and socket.time are now part of the library and are socket.sleep and socket.time are now part of the library and are
supported. supported.
Socket options interface has been improved and TCP now also supports socket
options.

9
README
View File

@ -1,12 +1,9 @@
This release is work in progress. It has been tested on WinXP, Mac OS X, This release is work in progress. It has been tested on WinXP, Mac OS X,
SunOS and Linux. The most important change is a major rewrite of the C code SunOS and Linux.
that attempts to make the library extensible. Also, all functions were
moved to the 'socket' namespace. A few changes are expected for the final
version, mostly in order to make the API more uniform.
In this version, all Lua code has been built into the binary. For that, you In this version, all Lua code should be built into the binary. For that, you
will need a working versions of luac and bin2c, both available with your will need a working versions of luac and bin2c, both available with your
Lua distribution. Check makefile for details. Lua distribution. Check the makefile for details.
Have fun, Have fun,
Diego Nehab. Diego Nehab.

4
TODO
View File

@ -1,8 +1,4 @@
- Melhorar a interface de setoptions (aceitar nada como true, por exemplo) - Melhorar a interface de setoptions (aceitar nada como true, por exemplo)
- Inicializaccao das classes pode falhar?
- Ajeitar melhor a hierarquia de classes. Ajeitar o file...
- GARBAGE COLLECTOR!
- Adicionar um método sock:setoption???
- testar em várias plataformas - testar em várias plataformas
- adicionar exemplos de expansão: pipe, local, named pipe - adicionar exemplos de expansão: pipe, local, named pipe

View File

@ -5,46 +5,45 @@
DIST = luasocket-2.0-alpha DIST = luasocket-2.0-alpha
LUA = \ LUA = \
auxiliar.lua auxiliar.lua \
code.lua code.lua \
concat.lua concat.lua \
ftp.lua ftp.lua \
http.lua \
select.lua \
smtp.lua \
url.lua
TESTS = \ TESTS = \
codetest.lua codetest.lua \
concattest.lua concattest.lua \
ftptest.lua ftptest.lua \
mbox.lua \
httptest.lua \
noglobals.lua \
smtptest.lua \
testclnt.lua \
testsrvr.lua \
udptest.lua \
urltest.lua
EXAMPLES = \ EXAMPLES = \
check-links.lua daytimeclnt.lua \
daytimeclnt.lua echoclnt.lua \
echoclnt.lua echosrvr.lua \
echosrvr.lua dict.lua \
dict.lua listener.lua \
talker.lua \
tinyirc.lua
ETC = \ ETC = \
cl-compat.lua check-links.lua \
cl-compat.lua \
get.lua \
lua.lua \
luasocket.lua \
tftp.lua \
get.lua
http.lua
httptest.lua
listener.lua
lua.lua
luasocket.lua
mbox.lua
noglobals.lua
select.lua
smtp.lua
smtptest.lua
talker.lua
testclnt.lua
test.lua
testsrvr.lua
tftp.lua
tinyirc.lua
udptest.lua
url.lua
urltest.lua
MAIN = \ MAIN = \
auxiliar.c \ auxiliar.c \
@ -57,10 +56,8 @@ MAIN = \
inet.h \ inet.h \
io.c \ io.c \
io.h \ io.h \
lua.c \
luasocket.c \ luasocket.c \
luasocket.h \ luasocket.h \
makefile \
select.c \ select.c \
select.h \ select.h \
socket.h \ socket.h \
@ -73,23 +70,24 @@ MAIN = \
usocket.c \ usocket.c \
usocket.h \ usocket.h \
wsocket.c \ wsocket.c \
wsocket.h \ wsocket.h
dist: dist:
mkdir -p $(DIST)/examples mkdir -p $(DIST)/examples
mkdir -p $(DIST)/tests mkdir -p $(DIST)/tests
mkdir -p $(DIST)/etc mkdir -p $(DIST)/etc
mkdir -p $(DIST)/lua
cp -vf $(MAIN) $(DIST) cp -vf $(MAIN) $(DIST)
cp -vf $(LUA) $(DIST) cp -vf $(LUA) $(DIST)
cp -vf makefile $(DIST) cp -vf makefile $(DIST)
cp -vf README $(DIST) cp -vf README $(DIST)
cp -vf lua.README $(DIST)
cp -vf NEW $(DIST)
cp -vf $(EXAMPLES) $(DIST)/examples cp -vf $(EXAMPLES) $(DIST)/examples
cp -vf README.examples $(DIST)/examples/README cp -vf examples.README $(DIST)/examples/README
cp -vf $(TESTS) $(DIST)/tests cp -vf $(TESTS) $(DIST)/tests
cp -vf README.tests $(DIST)/tests/README cp -vf tests.README $(DIST)/tests/README
cp -vf $(ETC) $(DIST)/etc cp -vf $(ETC) $(DIST)/etc
cp -vf README.etc $(DIST)/etc/README cp -vf etc.README $(DIST)/etc/README
tar -zcvf $(DIST).tar.gz $(DIST) tar -zcvf $(DIST).tar.gz $(DIST)
zip -r $(DIST).zip $(DIST) zip -r $(DIST).zip $(DIST)

View File

@ -120,6 +120,7 @@ test_methods(socket.tcp(), {
"setsockname", "setsockname",
"getpeername", "getpeername",
"getsockname", "getsockname",
"setoption",
"timeout", "timeout",
"close", "close",
}) })
@ -133,6 +134,7 @@ test_methods(socket.udp(), {
"sendto", "sendto",
"receive", "receive",
"receivefrom", "receivefrom",
"setoption",
"timeout", "timeout",
"close", "close",
}) })
@ -162,21 +164,16 @@ remote "data:send(str); data:close()"
end end
--test_mixed(1) test_mixed(1)
--test_mixed(17) test_mixed(17)
--test_mixed(200) test_mixed(200)
--test_mixed(4091) test_mixed(4091)
--test_mixed(80199) test_mixed(80199)
--test_mixed(4091) test_mixed(4091)
--test_mixed(200) test_mixed(200)
--test_mixed(17) test_mixed(17)
--test_mixed(1) test_mixed(1)
test_mixed(4091)
test_mixed(4091)
test_mixed(4091)
test_mixed(4091)
test_mixed(4091)
------------------------------------------------------------------------ ------------------------------------------------------------------------
test("character line") test("character line")
reconnect() reconnect()
@ -203,6 +200,11 @@ test_asciiline(200)
test_asciiline(4091) test_asciiline(4091)
test_asciiline(80199) test_asciiline(80199)
test_asciiline(800000) test_asciiline(800000)
test_asciiline(80199)
test_asciiline(4091)
test_asciiline(200)
test_asciiline(17)
test_asciiline(1)
------------------------------------------------------------------------ ------------------------------------------------------------------------
test("binary line") test("binary line")
@ -479,9 +481,7 @@ function test_selectbugs()
pass("invalid input: ok") pass("invalid input: ok")
end end
-- test_selectbugs() test_selectbugs()
test(string.format("done in %.2fs", socket.time() - start)) test(string.format("done in %.2fs", socket.time() - start))