lua-users home
lua-l archive

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

Thanks everyone for all these pointers. The solution from Bruno is the most promising since it seems to be a patch over LuaSocket (haven't looked at the code yet, I hope comments are in english :D ). Maybe it can be used as a start point for LuaSocket SSL support (depending on what is already done in DB implementation). 

Related to network I have another question. Are Lua strings well suited to handle arbitrarily long binary data objects ? Let me give some details.

If I have two different C libs to interconnect, for example a networking (transport) one and a data processing one, and they don't know each other, what is the prefered way to transfer data between them ? I initially thought that full userdata would be ideally suited, with the data length as a seperate information :

size = 1024
buffer = newuserdata(size)
-- Create initial data
mylib.process_request(buffer, size)
-- Write it to socket
mysocket.write(buffer, size)
-- Read answer
buffer =
-- Process data received
mylib.process_answer(buffer, size)

I just need a function in Lua base lib to allocate a buffer (I called it newuserdata in my example), and eventually some others to write to it from Lua.

The alternative solution is to use strings instead of userdata (IIRC LuaSocket is using strings). But it may require frequent allocations of short lived very long strings containing arbitrary bytes (including '\0' bytes). Can Lua handle this ? Is there a way to remove a string from the string registry or is it automatic when it's not referenced anymore ?

-----Message d'origine-----
De : [] De la part de Bruno Oliveira Silvestre
Envoyé : 12 août 2006 07:11
À : Lua list
Objet : Re: LuaSSL, LuaSocket ?


On 8/11/06, Jerome Vuarand <> wrote:
> I was looking for a binding of OpenSSL for Lua, and found something 
> called luassl.

I worked in a binding for OpenSSL months ago, you can find it at

The site is in portuguese (sorry), but LuaSec uses the same API of LuaSocket and the samples in "Testes" link can help you. You can send me e-mail if you have some problem.

T+, bruno