Maybe I am wrong!
As I know WICED SDK 3.1.2 did not enable multi-home feature in Network Stack!
So you could not create socket on one interface then send/received on different interface!
I don't want it to work on multiple interfaces.
It is working on the STA interface.
But when I turn on the AP interface in words of wiced_network_up, then I get above problems on STA interface.
It can still receive the UDP packets but not send them anymore.
May be a wild guess...
Is that causing beacause there's an argument to specify what mode are we in while creating UDP socket , may be that's not proper
wiced_udp_create_socket( &udp_socket, PORTNUM, WICED_AP_INTERFACE )
Here the expected mode is AP mode, but here if you're running in STA mode this might can cause the issue
The UDP socket is already created on the STA interface, but when I turn on the AP interface later on the UDP send is broken on the existing socket.
In the end I figured out that both interfaces were on same subnet. The app interface was on 192.168.1.x/16 and my STA interface was on 192.168.0.x/24.
The ip_route function in lwip looks for the first match of ip address and subnet with the destination address. Reply's were send out on the AP network instead of the STA when the AP was activated.
Ended up putting the AP interface in 172.16.x.x range and then it works without any problems.