Hallo,
ich verwende das SDK V2.1.0. Ich arbeite also nicht mit Arduino.
Ich will von meinem ESP auf eine HTML-Seite im Netz zugreifen. Ich habe mir gedacht dass ich dazu TCP verwenden kann und mit espconn_send meine GET Anfrage schicken kann. Unten ist mein Code.
Leider bekomme ich -12 (=ESPCONN_ARG) als Rückgabewert. Kann mir jemand sagen, was ich falsch mache?

Besten Dank,
drewle

Code:
void init_Tcp_client(void)
{
   sint8 s8_err;

   os_printf("init_Tcp_client\r\n");

   // Preset t_tcp. only remote_port is needed
   gt_tcp2.local_ip[0] = 192;    // setting the local IP seams not to be really needed
   gt_tcp2.local_ip[1] = 168;
   gt_tcp2.local_ip[2] = 178;
   gt_tcp2.local_ip[3] = 20;
   gt_tcp2.local_port = 80;
   gt_tcp2.remote_ip[0] = xxx;
   gt_tcp2.remote_ip[1] = xxx;
   gt_tcp2.remote_ip[2] = xxx;
   gt_tcp2.remote_ip[3] = xxx;
   gt_tcp2.remote_port = 80;
   gt_tcp2.connect_callback = NULL;   // as the global variables are set to 0 this is not really needed
   gt_tcp2.reconnect_callback = NULL;
   gt_tcp2.disconnect_callback = NULL;
   gt_tcp2.write_finish_fn = NULL;

   gt_conn2.type = ESPCONN_TCP;
   gt_conn2.state = ESPCONN_NONE;
   gt_conn2.proto.tcp = &gt_tcp2;
   gt_conn2.recv_callback = recv_Cb;
   gt_conn2.sent_callback = NULL;   // as the global variables are set to 0 this is not really needed
   gt_conn2.link_cnt = 1;
   gt_conn2.reverse = NULL;

   // wait for the connection of a client
   s8_err = espconn_accept(&gt_conn2);
   os_printf("espconn_accept: %d\r\n",s8_err);

   os_printf("gt_conn2.state: %u\r\n",gt_conn2.state);
}

void my_timer_function(void *timer_arg)
{
   uint16 u16_AdcVal;
   sint8 s8_err;

//   if( gu8_GotIp==true )
   {
      // Read the ADC value
      u16_AdcVal = system_adc_read();
      os_printf("ADC Value: %u\n", u16_AdcVal);

      os_printf("gt_conn2.type: %u\r\n",gt_conn2.type);
      os_printf("gt_conn2.state: %u\r\n",gt_conn2.state);
      os_printf("gt_conn2.proto: %llu\r\n",gt_conn2.proto);
      os_printf("gt_conn2.recv_callback: %llu\r\n",gt_conn2.recv_callback);
      os_printf("gt_conn2.sent_callback: %llu\r\n",gt_conn2.sent_callback);
      os_printf("gt_conn2.link_cnt: %u\r\n",gt_conn2.link_cnt);
      os_printf("gt_conn2.reverse: %llu\r\n",gt_conn2.reverse);

      // send request
      s8_err = espconn_send(&gt_conn2,gc_Request,strlen(gc_Request));
      os_printf("espconn_send: %d\r\n",s8_err);
   }
}