Using Telnet in App

I'm working on an app that uses Telnet.

It's basically working fine in my tests but I have an issue.

Right now I am using, in the app, a reference to a virtual switch to command the Telnet code to connect/disconnect.

What I really would like would be someway to have the app periodically try to connect to the Telnet server.

Any ideas?

Thanks, Frederick

I think I would be inclined to just use some error handling so that if the connection gets closed, you can call your connect method again.

2 Likes

I believe the telnet API is only available within a Driver, not an App. You should be able to keep all of the Telnet logic, including reconnect logic, all within the driver.

Drivers are used by devices, which expose Attributes and Commands that are then used by Applications.

You can create a repeating scheduled routine within the driver that periodically checks on the overall health of the Telnet connection, and then have it reconnect. Most times, though, the driver gets notified that the Telnet session has ended. Based on this event, the driver can then start to attempt reconnecting periodically, until the session is reestablished. Usually, the Apps that would be using the driver need never know exactly how the device is connected to the physical hardware (Telnet, webSocket, Zigbee, Z-Wave, etc...)

5 Likes

A schedule sounds like it would do what I need.

Thanks, Frederick

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.