My recent project work included applications with a servo drive controller that offers a simple text-based protocol via TCP. We many times explain this to our clients as the fastest way to integrate the drive, especially if their part is a standalone Windows software project that does not already have any fieldbus communications up and running. But to our own surprise, discussions went frequently like this: “We recommend the direct TCP interface - this is so much easier than adding extra Ethercat or Profinet equipment for this purpose.“ “Yes, but how does TCP work? ” “Easy. Just open a TCP client connection to the drive controller, and send these simple ASCII commands.” “Yes, but I have no idea about TCP connections. Don’t you have a simple DLL for this?” So we decided to help out and make a DLL indeed. Not one that implements the servo controller interface, but a simplistic and generic way of processing text-based protocols and dealing with the TCP socket connection. And I felt
How to make a PC talk industrial serial or fieldbus protocols via RS232/RS485/TCP/MODBUS/CAN/CANopen and the likes. Every now and then you come across this tiny annoying piece of functionality, where Google or Microsoft don't really help out and make you think: "How come no one ever published a small piece of code or some cookbook advice?" So I am happy to share some insight and code.