Code: Select all
wifi_set_opmode_current( STATIONAP_MODE );
My connection code is made from the
Code: Select all
case EVENT_STAMODE_GOT_IP
Code: Select all
os_memset( &connector, 0, sizeof(connector));
connector.type = ESPCONN_TCP;
connector.state = ESPCONN_NONE;
connector.proto.tcp = &tcp_con;
os_memset( &tcp_con, 0, sizeof(tcp_con));
tcp_con.local_port = espconn_port();
tcp_con.remote_port = tcp_port;
os_memcpy ( tcp_con.remote_ip, serverIp, 4 );
espconn_regist_connectcb( &connector, tcpConnected );
espconn_regist_disconcb( &connector, tcpDisconnected );
if ( err = espconn_connect ( &connector ) != 0 )
{
os_printf ( "Error connecting: %d", err );
}
Basically in STATION_MODE, it connects immediately, in STATIONAP_MODE, it doesn't do anything. I was sure to set the local_ip in the tcp structure, and the esp_connect function seems to return '1', which is indicated as an error in the documentation but it doesn't list which one (i.e. anything non 0 is apparently an error, but 1 is not one of the listed types).
Any ideas? Making an outbound connection when an AP is being hosted should work right? I'm using version 1.3 of the SDK.