0

I have a Leonardo with a Yun shield, and I would like to be able to control the arduino with a windows form app, but thats besides the point for now at least. Currently, I am using putty and the commands Telnet Localhost 6571. However, I would like to avoid doing that and I was wondering if anybody new how to communicate with the arduino from port 22 at the yun's IP, rather than connecting to the yun and then to the remote local machine. That or I am missing something entirely!

This is the code I am using to try and access the console port of the Leonardo:

namespace ConsoleApp2
{
 class Program
 {
 static void Main(string[] args)
 {
 //connect to arduino 
 ConnectionInfo ConnNfo = new ConnectionInfo("10.1.1.211", 22, "root", new AuthenticationMethod[] { new PasswordAuthenticationMethod("root", "123456789") });
 using (var sshclient = new SshClient(ConnNfo))
 {
 sshclient.Connect();
 //connect to console port of arduino
 TcpClient tcp = new TcpClient("localhost", 5671);
 sshclient.Disconnect();
 }
 Console.ReadKey();
 }
 }
}

Thank you

Edgar Bonet
45.1k4 gold badges42 silver badges81 bronze badges
asked Aug 27, 2017 at 17:45

1 Answer 1

1

The console port is only listening on 127.0.0.1 (for security), so only the Yun itself can connect to the console.

You can weaken security and open the port up to the entire local network by editing the file /usr/lib/python2.7/bridge/console.py and change the value 127.0.0.1 to 0.0.0.0.

Any machine on your local network will then be able to connect directly to port 6571.

answered Aug 27, 2017 at 18:28
3
  • Thanks for the help, how would I connect to that port via my pc without using Telnet, I edited the file as per your instructions. Commented Aug 28, 2017 at 5:26
  • You can use putty in telnet mode to connect direct to the port. Commented Aug 28, 2017 at 8:18
  • Alternatively you can write your own software in whatever language you prefer to open a TCP connection directly and use it as if it were a serial port. Commented Aug 28, 2017 at 12:27

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.