Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: ATU on February 28, 2014, 03:51:25 PM
-
Would it be possible to write a program for the DOmore to talk telnet? If so, best guess difficulty on a scale from 1-10?
-
I've done a TelNet Server. BobO's done a TelNet Server. It's not that hard if you already understand TCPLISTEN.
TelNet Client, even easier.
I've attached the Server I did. It's a little dated - the STRING handling could be cleaned up a little.
As with all examples, this is for educational purposes only and the user assumes all responsibility for its use.
It accepts the following commands:
HELP - dumps these commands
READIO - dumps the first 32 X's and 32 Y's in hexadecimal
STATS - dumps IP Address, firmware rev, scan time
TIME - dumps current time in the PLC
DATE - dumps current date in the PLC
EXIT - terminate the session
-
I guess i need a Client app. Trying to pull data streaming from a device. I think once you give it the command, it just continuously spews data via telnet.
-
Easy peasy...
Keys to success:
1. Create a TCPClient device.
2. Connect to your Telnet server by calling OPENTCP passing the IP and Port.
3. The .InQueue member of the structure associated with the TCPClient device will show pending data.
4. Call STREAMIN to read data. I generally prefer to wait for data in the queue prior to calling STREAMIN, so STREAMIN can expected to succeed without delay.
5. The .Connected member will remain true as long as your connection is good. Call OPENTCP again if the connection gets dropped.
6. A dedicated program block using stages to sequence the protocol is your friend.
7. Pat yourself on the back for how cool you were to do a custom protocol in a PLC.
-
Thanks!