Chat freely about anything...
User avatar
By CARPP
#55011 Hi,

i currently have problems to connect to my server via tcp. The connection to my local wifi network works fine, but this doesn't work:

Code: Select allLOCAL void ICACHE_FLASH_ATTR
check_ip(void){
   struct espconn conn;
   struct ip_info ipconf;
   uint32_t ipAddr = ipaddr_addr("1.2.3.4");
   uint32 localPort = espconn_port();
   bool res = wifi_get_ip_info(STATION_IF, &ipconf);
   if(!res)
      os_printf("No Success.");
   else{
      if(wifi_station_get_connect_status() == STATION_GOT_IP && ipconf.ip.addr != 0){
         os_printf("Got IP Address.\n");
         conn.type = ESPCONN_TCP;
         conn.state = ESPCONN_NONE;
         conn.proto.tcp = (esp_tcp*)os_zalloc(sizeof(esp_tcp));
         conn.proto.tcp->local_port = espconn_port();
         conn.proto.tcp->remote_port = 80;
         os_memcpy(conn.proto.tcp->remote_ip,&ipAddr,4);

         espconn_regist_connectcb(&conn,tcp_connect_cb);
         espconn_regist_reconcb(&conn,tcp_recon_cb);

         espconn_connect(&conn);
         os_timer_disarm(&timer);
      } else {
         os_timer_setfn(&timer,(os_timer_func_t*)check_ip,NULL);
         os_timer_arm(&timer,100,0); //recall function after 100ms, don't repeat
      }
   }
}


This is the error i get on the serial terminal:

Fatal exception 9(LoadStoreAlignmentCause):
epc1=0x4026023f, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000011, depc=0x00000000


Any help is very much appreciated! :)