It seems the way I test multiple connection is wrong.
Now I hit below issue:
If I create 2 sockets and call wiced_tcp_listen() to listen on the same port.
The second wiced_tcp_listen() call always fails with error code 21.
I also check the LwIP implementation for wiced_tcp_accept(),
it looks like wiced_tcp_accept will delete previous connection and use the
same connection handler to accept a new one.
So my question is:
How to use wiced APIs to support multiple connection on the same port?
Any code snip for handling multiple connection on the same port available for reference?
Do you want to use same port# on TCP?
I think it doesn't work.
Isn't TCP server supporting multiple client a normal scenario ?
How about calling 2nd listen after 1st connection is established?
I want to allow multiple clients to connect to my tcp server.
I think the main issue is wiced_tcp_accept() deletes previous connection and
use the same connection handler to accept a new one.
if ( socket->accept_handler != NULL )
/* delete previous connection and use the same connection handler to accept a new one */
status = netconn_delete( socket->accept_handler );
socket->accept_handler = NULL;
if ( status != ERR_OK )
return LWIP_TO_WICED_ERR( status );
Wich means wiced APIs does not support multiple connection.
I can do some hack to take over the handling of socket->accept_handler after
wiced_tcp_accept() return success in my own code and it then looks works,
however it means I have to use the lowl evel APIs rather than wiced APIs to
handle tcp packets. Which means my application can only compile with FreeRTOS+LwIP.
I just wondering is it really not able to use wiced APIs for handling multiple
connections? Did I miss something? It's a very common use case, isn't it?
Your question is not that clear, NetX or NetXDuo do not support multiple tcp connections not possible ? By my understanding you make your wiced hardware as a soft ap and you can have two different devices connected to this soft ap ( mutliple tcp connections on same port). You can try the appliance app inside demo folder. Let me know if you need some more help.
1 of 1 people found this helpful
It's nothing to do with soft-ap.
What ever we need is to implement a tcp server that allows multiple connection.
Now I found wiced_tcp_server_start() in sdk-3.1.0 is what we need.
BTW, I have reported the issues on the forum about using wiced_tcp_server_start().
I have some questions about this post.
Is it possible to use multiple tcp socket simultaneously when WICED is running as SoftAP?
For example, WICED is running as SoftAP and STA1 is connected to SoftAP of WICED, and STA2 is also connected to SoftAP. And then, is STA1 able to transmit packets to STA2 through SoftAP of WICED? As I know, to be possible this scenario, SoftAP of WICED has to support multiple tcp socket simultaneously.
Is it possible?
In WICED SoftAP mode it is act just like a normal AP does, except the limitation !
STA1 and STA2 could send packet to each other as SoftAP act as L2 bridge in wireless media!
With or without TCP server it should act the same!
TCP server support multi-client is possible after SDK 3.1.1 via wiced_tcp_server_start to create the TCP server!
You should take a look and play with the demo/temp_control example code