Telnet Client

Zazamuh
Offline
Зарегистрирован: 22.03.2015

Добрый день!

Пытаюсь подключиться к роутеру Mikritik протоколом telnet, в монитор порта получаю ответ:

connecting...
connected
яэяэ яэ#яэ'

Вот сам код:

/*
  Telnet client

 This sketch connects to a a telnet server (http://www.google.com)
 using an Arduino Wiznet Ethernet shield.  You'll need a telnet server
 to test this with.
 Processing's ChatServer example (part of the network library) works well,
 running on port 10002. It can be found as part of the examples
 in the Processing application, available at
 http://processing.org/

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13

 created 14 Sep 2010
 modified 9 Apr 2012
 by Tom Igoe

 */

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 88, 177);

// Enter the IP address of the server you're connecting to:
IPAddress server(192, 168, 88, 1);

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 23 is default for telnet;
// if you're using Processing's ChatServer, use  port 10002):
EthernetClient client;

void setup() {
  // start the Ethernet connection:
  Ethernet.begin(mac, ip);
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  // give the Ethernet shield a second to initialize:
  delay(3000);
  Serial.println("connecting...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 23)) {
    Serial.println("connected");
  }
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

void loop()
{
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  // as long as there are bytes in the serial queue,
  // read them and send them out the socket if it's open:
  while (Serial.available() > 0) {
    char inChar = Serial.read();
    if (client.connected()) {
      client.print(inChar);
    }
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    // do nothing:
    while (true);
  }
}


Из винды подключаюсь корректно, справшивает логин и пароль, заходит без проблем.

Прогуглил пол инета, везде пишут разное, но вроде все завязано на настройках клиента. Подскажите, как его настроить?

inspiritus
Offline
Зарегистрирован: 17.12.2012

а какова высокая цель сего действа ?

Zazamuh
Offline
Зарегистрирован: 22.03.2015

Отправка почты. Микротик умеет работать с SSL, а ардуино нет.

inspiritus
Offline
Зарегистрирован: 17.12.2012

Вы микротика в режиме n с яблоками не пользуете ?

Zazamuh
Offline
Зарегистрирован: 22.03.2015

Вы про wifi? Да, пользую.

inspiritus
Offline
Зарегистрирован: 17.12.2012

У меня Routerboard-750. Никак не могу настроить работу в b/g/n. Когда b/g проблем нет,все яблоки летают. Как только подключаю n яблоки отваливаются. В общем и без n скорость, определяемая спидтестом не хуже скорости тарифного плана. Однако непорядок :)

Может быть что подскажете ? Типа волшебный крыжык на пятой закладке...

Zazamuh
Offline
Зарегистрирован: 22.03.2015

Вот мои настройки. Остальное все по дефолту. 951 модель.

Настройки

Gippopotam
Gippopotam аватар
Offline
Зарегистрирован: 12.09.2014

Не понятно, какая скорость порта у роутера. Может просто не 9600?

Zazamuh
Offline
Зарегистрирован: 22.03.2015

Сложно сказать, но я проверял на всех, та же фигня.

Andrey-S
Offline
Зарегистрирован: 02.01.2015

У меня примерно та же самая фигня с подключением сим-модуля SIM900R, Putty работает, а через ардуинку каракули... Со скоростью порта игрался, системами счисления этими... Нифига, все равно каракули

inspiritus
Offline
Зарегистрирован: 17.12.2012

Мдэ. Протокол any все коннект не устанавливается, только с 802.11, каки в присутствии n.