I have an optoma projector and I want to communicate to it using Telnet session from inside the C# program. Using various wrappers and Nuget packages, I am able to start the telnet session but I am not abe to communicate commands or receive response in my C# program.
In a normal windows cmd, if I write Telnet 192.168.222.127, telnet session begins. The projector responds to commands in ASCII format(https://www.optoma.de/uploads/RS232/DS309-RS232-en.pdf) and it returns 'F' or 'P' based on if command Failed or passed. To change brightness to 10, I would do something like this:
- open a Telnet Connection :
telnet 192.168.222.127 - Send a command to change brightness to 10 : ~0021 10
- Session will respond with a 'P' as the command passed in changing brightness. Telnet Terminal Commands
I want to do the same with C# program but I am stuck. Most of the answers point to outdated packages and link. I am new to Telnet and communication protocols and need help regarding this. Thank you.
If you simply want to connect to the device, send in the command and read the response, simple C# TcpClient is enough. It provides client connections for TCP network services which was just right for my case.
For establishing connection :
For sending and receiving response :
You may parse the response from the server based on your requirements.