Chat freely about anything...

User avatar
By rith87
#10104 I've managed to get my ESP8266 to have Chromecast-esque set up functionality and the ability to establish TCP connections to a webserver (thanks to sprite_tm and his e-ink example: http://git.spritesserver.nl/espeink.git/). However, I'm hitting a problem where espconn_connect() returns ESPCONN_RTE. Here's my bit of code:

Code: Select allvoid ICACHE_FLASH_ATTR httpclientFetchIP(ip_addr_t *ip) {
...
  struct espconn *pespconn = (struct espconn *)os_zalloc(sizeof(struct espconn));
  pespconn->type = ESPCONN_TCP;
  pespconn->state = ESPCONN_NONE;
  pespconn->proto.tcp = (esp_tcp *)os_zalloc(sizeof(esp_tcp));
  pespconn->proto.tcp->local_port = espconn_port();
  pespconn->proto.tcp->remote_port = 80;

  *((uint8 *) &pespconn->proto.tcp->remote_ip)     = (ip->addr >> 24) & 0xff;
  *((uint8 *) &pespconn->proto.tcp->remote_ip + 1) = (ip->addr >> 16) & 0xff;
  *((uint8 *) &pespconn->proto.tcp->remote_ip + 2) = (ip->addr >> 8) & 0xff;
  *((uint8 *) &pespconn->proto.tcp->remote_ip + 3) = (ip->addr) & 0xff;

  espconn_regist_connectcb(pespconn, httpclientConnectedCb);
  espconn_regist_disconcb(&conn, httpclientDisconCb);
  // espconn_regist_reconcb(pespconn, httpclientDisconCb);
  int8_t res = espconn_connect(pespconn);
  os_printf("espconn_connect() returned %d", res);   
}


However, if I called espconn_gethostbyname() (with a URL instead of an IP address) before espconn_connect(), then the ESP8266 connects to it fine. Does espconn_connect() work without calling espconn_gethostbyname()? Or does anyone know what espconn_connect() returning ESPCONN_RTE means?
User avatar
By rith87
#10187 Is there anyone out there who is using espconn_connect() with just an IP address? Or in other words, does anyone call espconn_connect() without espconn_gethostbyname()?

I have several suspicions:

Code: Select all  espconn_regist_connectcb(pespconn, httpclientConnectedCb);
  espconn_regist_disconcb(&conn, httpclientDisconCb);


Does the above code set the "espconn_recv_callback" or "espconn_sent_callback" on espconn?

My next suspicion is with the link_cnt and reverse since my code does not set it. Or does anyone have other ideas?