lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I have come with what appears to be a bug in LuaSocket.
I'm using LuaSocket 2.0.1 on Linux

According to the reference manual,
client:receive(pattern, prefix) can have an optional prefix string
which will be prepended to any received data. This does not work for me if the pattern is a number:

require "socket"

addr = "127.0.0.1"
port = 10000

s = assert(socket.connect(addr, port))
print("connected to peer: ", s:getpeername())

-- sending "12345\n"
res = assert(s:receive(2))
print(">>res:", res) --> 12

--res = assert(s:receive("*l", res))
--print(">>res:", res) --> 12345
res = assert(s:receive(2, res))
print(">>res:", res) --> 12 <--------------- BUG

--
Mit freundlichen Grüßen

Jesus Ruiz de Infante
(Entwicklung)
HALE electronic GmbH
Eugen-Müller-Straße 18, 5020 Salzburg, Austria
Tel:  +43 (662) 439011 0
Fax:  +43 (662) 439011 9
jesus.ruizdeinfante@hale.at
Firmenbuchnummer: FN 66801m HG Salzburg



--
Scanned by MailScanner.