Мигрированная версия LWIP и не может подключиться через TCP - PullRequest
0 голосов
/ 04 ноября 2018

Итак, я недавно перешел на v2.0.3 LWIP для устройства шлюза, которое я разработал. Это основано на микроконтроллере ATSAME70. Основная функция - отправить HTTP-сообщение на сервер, но по какой-то причине tcp_connect теперь возвращает либо ERR_RTE, либо ERR_VAL. В документации LWIP не так много полезных указателей относительно того, что это за ошибки и что можно сделать, чтобы их исправить. Вот функция настройки клиента TCP (здесь я использовал x для IP-адреса, но, очевидно, в реальном коде это правильный IP-адрес):

struct ip_addr cloud_ip;

/**
 * Set up and initialise the TCP connection for sending a reading to the cloud.
 *
 */
void tcp_cloud_setup_reading_post(void)
{
    // Temp Buffer for IP Addresses
    static char tmp_buff[16];

    // Set the IP Address of the Data Pipeline
    ipaddr_aton("xxx.xxx.xxx.xxx", &cloud_ip);

    // Print a Message
    printf("Attempting Cloud Post to %s -> ", ipaddr_ntoa_r((const ip_addr_t *)&(cloud_ip), tmp_buff, 16));

    // Create a Struct for the TCP Connection
    struct tcp_pcb *cloud_pcb;

    // Create a new PCB for the TCP Connection
    cloud_pcb = tcp_new();

    // Set the Connection Error Callback Function
    tcp_err(cloud_pcb, tcp_cloud_connection_error);

    // Set the Sent Callback Function
    tcp_sent(cloud_pcb, tcp_cloud_reading_sent);

    // Set the Receive Callback Function
    tcp_recv(cloud_pcb, tcp_cloud_get_timestamp);

    // Connect to the Cloud Server
    //tcp_connect(cloud_pcb, &cloud_ip, 80, tcp_cloud_connect_reading_post);
    err_t tcp_error_conn = tcp_connect(cloud_pcb, &cloud_ip, 80, tcp_cloud_connect_reading_post);

    printf("ERROR CODE: %d\r\n", tcp_error_conn);
}

Если у кого-то есть какие-либо предложения относительно того, почему я получаю ошибки, пожалуйста, дайте мне знать!

Спасибо

  • Andy
...