How to deal with the telnet negotiation

2019-09-05 23:17发布

问题:

Currently I'm tring an telnet client sample written by C# to connet a data acquisition unit, I could connect the server and send the commands, but I always received the same data (I cound't post images, the data is{255,253,3,255,254,1,255251,1}). I also do some research, seems this problem is related telnet protocol/negotiation, but I don’t have any more idea and experience on that what should I do, could anyboday please help to look at it? any suggestion & solution is appreciated.

others, I could directly use the telnet of OS to execute related commands to see the correct data.

回答1:

If you don't need to display anything in a terminal window, respond to DO & WILL with WON'T to all offers. Replace 253/254 with 252 and send back to server. There maybe more negotiation from the server. Respond again as described above. After negotiation, log-in & password should follow, unless authentication is disabled. A successful log-in will follow copywright and other info till the user-prompt arrives. Now you are able to send OS-commands and process the response you get.



标签: c# .net telnet