
In order to recevie a udp packet from station side and softAp side, I made simple source code.
SDK version the latest version (esp_iot_sdk_v1.0.1_b2_15_04_10)
wifi mode station and softAp mode
Code: Select all
static void ICACHE_FLASH_ATTR mng_udp_init( void )
{
g_mng_udp_esp_conn.type = ESPCONN_UDP;
g_mng_udp_esp_conn.state = ESPCONN_NONE;
g_mng_udp_esp_conn.proto.udp = &g_mng_udp_espudp;
g_mng_udp_esp_conn.proto.udp->local_port = MNG_UDP_PORT;
espconn_regist_recvcb(&g_mng_udp_esp_conn, mng_udp_recv);
espconn_create(&g_mng_udp_esp_conn);
}
static void ICACHE_FLASH_ATTR mng_udp_recv(void *arg, char *rxmsg, unsigned short len)
{
struct espconn *pesp_conn = arg;
os_printf("\nmng udp recv %d.%d.%d.%d %d -> %d.%d.%d.%d %d state(%d)\n",
pesp_conn->proto.udp->remote_ip[0],
pesp_conn->proto.udp->remote_ip[1],
pesp_conn->proto.udp->remote_ip[2],
pesp_conn->proto.udp->remote_ip[3],
pesp_conn->proto.udp->remote_port,
pesp_conn->proto.udp->local_ip[0],
pesp_conn->proto.udp->local_ip[1],
pesp_conn->proto.udp->local_ip[2],
pesp_conn->proto.udp->local_ip[3],
pesp_conn->proto.udp->local_port, pesp_conn->state
);
}
ESP8266 can receive the 1st packet from any direction.
Thereafter, ESP8266 can receive the packet is received in only one direction.
[Testing Procedure 1]
SmartPhone1 --(1)--> ESP8266 <--(3)-- CISCO AP <--(3)-- SmartPhone2
1. SmartPhone1 send a udp packet to the ESP8266
2. ESP8266 can receive that one.
3. Using the same destination udp port, SmartPhone2 send a udp packet to the ESP8266
4. ESP8266 can't receive udp packet.
[Testing Procedure 2]
0. Restart the esp8266 (power reset)
SmartPhone1 --(3)--> ESP8266 <--(1)-- CISCO AP <--(1)-- SmartPhone2
1. SmartPhone2 send a udp packet to the ESP8266
2. ESP8266 can receive that one.
3. Using the same destination udp port, SmartPhone1 send a udp packet to the ESP8266
4. ESP8266 can't receive udp packet.
[Testing Procedure 3]
0. Without system restart
SmartPhone1 <--(1)-- ESP8266 --(3)--> CISCO AP --(3)--> SmartPhone2
1. ESP8266 send a udp packet to the SmartPhone1
2. SmartPhone1 can receive the packet.
3. ESP8266 send a udp packet to the SmartPhone2
2. SmartPhone2 can receive the packet.
In order to solve this problem, I need your help.

Thanks,
Peter