David Posted November 22, 2013 Share Posted November 22, 2013 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 More sharing options...
seth_j Posted November 22, 2013 Share Posted November 22, 2013 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 More sharing options...
RyanE Posted November 22, 2013 Share Posted November 22, 2013 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 More sharing options...
david@berto.co.uk Posted November 23, 2013 Share Posted November 23, 2013 Thanks RyanI have used the luasocket functions directly as this avoids the use of state type programming with the standard API and these work fine. Shame about the SSL. Do you know what version of lua is running from director? Why would they have a different version on the command line???ThanksDavid Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.