[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: C lib data interconnection and RE: LuaSSL, LuaSocket ?
- From: "Jerome Vuarand" <jerome.vuarand@...>
- Date: Tue, 15 Aug 2006 10:34:33 -0400
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
-- Write it to socket
-- Read answer
buffer = mysocket.read(size)
-- Process data received
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 ?
De : firstname.lastname@example.org [mailto:email@example.com] 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 <firstname.lastname@example.org> 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.