Jump to content
c4forums | The Control4 Community

Destroy Network Connection

Recommended Posts

I am writing a driver that needs to be able to dynamically create and destroy SSL connections in order to connect (and disconnect) to an indeterminate number of devices. Due to the inherent unpredictability of how many devices will be connected at a given time, I need this to be able to be done programmatically. I'm comfortable enough with Lua, and have written a few simple drivers before, but none with this type of requirement. I'm essentially looking for the opposite of C4:CreateNetworkConnection(). Can someone point me in the right direction?

I looked at the example drivers provided on C4's Github and it looks like they use C4:NetDisconnect() calls to 'remove' connections created with C4:CreateNetworkConnection(). I attempted this approach, but all it seems to do is to temporarily (until my reconnect handler executes) break the connection, without actually removing it. So far, the only thing I've found that will remove the connections is doing a driver reboot, but I'd like to avoid having to do that every time I need to remove a connection.


Thanks all!

Link to post
Share on other sites

You can reuse binding IDs and call C4:CreateNetworkConnection with a different address on the same binding id.

Not sure what the issue is with doing that.  As long as you don't do a C4:NetConnect, having dynamic network connections created doesn't really take any resources.


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...