Jump to content
C4 Forums | Control4

LUA Development - TCP sockets and SSL


David

Recommended Posts

Hi All,

 

I have started developing in LUA and am not looking at using within C4 for some drivers.

 

I notice that the LUA on C4 does have the socket and ssl modules available to it and from the command line on the controller you can use these modules directly and they work fine.

 

I am particularly interested in SSL as access to this module from LUA allows me to upgrade the state of an existing connection to SSL as is required when negotiating with an SMTP server using STARTTLS to move from a plain connection to an SSL one.

 

Whilst I can call socket functions directly at runtime from within driver code any calls to the SSL module eg. ssl.wrap lead to a an error :-

 

error loading module 'ssl' from file '/control4/lib/lua/5.1/ssl.so':

/control4/lib/lua/5.1/ssl.so: undefined symbol: luaL_prepbuffer

 

This implies that the runtime version of LUA from C4 is different to the command line version on the controller ie. 5.1.4.

 

A standalone program on the controller will work fine using the LUA binary in /control4/bin along with the SSL and SOCKET modules but from Composer Pro or the director itself it fails with the above message.

 

I know that within the C4 API there are network functions and in particular C4:CreateNetworkConnection which does create an SSL connection but I can not see how I can use this to start an plain connection and then upgrade it to SSL, what other connection types are available to this API?

 

Any pointers much appreciated.

 

Thanks

 

 

David

 

 

 

 

 
Link to comment
Share on other sites


There is only one way of using sockets in Control4 drivers and that is through the ServerSockets API on 2.0 and up systems.

 

I don't think there is support for SSL built in but it may be something you can add on/write yourself. I have also been wrong many times.

Link to comment
Share on other sites

There is no luasocket support in DriverWorks drivers, for various reasons.

 

The only 'client socket' type support is through network bindings (connections), which are provided by Director for drivers.

 

You are correct in noting that the SSL support in DriverWorks' network connections are not 'upgradeable' the way you're asking.  They were designed to connect to HTTPs servers, and mainly work for that purpose.

 

The Lua interpreter used in DriverWorks drivers is embedded into Director, and is different from the command-line Lua interpreter executable.

 

RyanE

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.