Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using telnet in a C Program

I am working on a robot automation project and I have run into a road block. To control the robot, one needs to connect with it wirelessly via telnet and send commands through the tcp/ip protocol. (ex. The 'Mabc' command moves it forward based on the left wheel speed (a), the right wheel speed (b) and time (c)). What I am trying to do is do some calculations in a C program and then send a message to the robot based on the value of the calculation.

How can send commands via tcp/ip protocol in a C program?

Thanks!

Erik

like image 535
user28023 Avatar asked Oct 14 '08 21:10

user28023


People also ask

How do I run a program using telnet?

Go to Start > Run (or press Windows button+R). In the Run window type cmd and click OK to open the Command prompt. Type in telnet [RemoteServer] [Port]. If you are trying to connect to Intermedia mail server, type in your MX record for the [RemoteServer].

What is telnet in programming?

Telnet is a network protocol used to virtually access a computer and to provide a two-way, collaborative and text-based communication channel between two machines. It follows a user command Transmission Control Protocol/Internet Protocol (TCP/IP) networking protocol for creating remote sessions.

How does telnet work step by step?

The user connects to the server by using the Telnet protocol, which means entering Telnet into a command prompt by following this syntax: telnet hostname port. The user then executes commands on the server by using specific Telnet commands into the Telnet prompt.


1 Answers

You are looking for sockets. This is a comprehensive guide to socket programming in C. Telnet is also a well defined protocol, although I don't know if this robot would use telnet or not (it's extra processing overhead for a protocol that wouldn't have much added benefit for a robot control program). Telnet is covered in detail by RFC 854

like image 54
Matthew Scharley Avatar answered Oct 11 '22 05:10

Matthew Scharley