NetX/NetX_Duo does not support multiple tcp connection at the same time

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

hi,

I'm using sdk 3.0.1.

The default WICED_DEFAULT_TCP_LISTEN_QUEUE_SIZE is 5.

But I found when build image with NetX/NetX_Duo, I can only have 1 connection.

Build with LwIP seems fine.

0 Likes
1 Solution
Anonymous
Not applicable

Hi Vik86,

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().

View solution in original post

9 Replies
Anonymous
Not applicable

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?

Any suggestions?

Thanks.

0 Likes
Anonymous
Not applicable

Do you want to use same port# on TCP?

I think it doesn't work.

0 Likes
Anonymous
Not applicable

Isn't TCP server supporting multiple client a normal scenario ?

0 Likes
Anonymous
Not applicable

How about calling 2nd listen after 1st connection is established?

0 Likes
Anonymous
Not applicable

Hi dmlya,

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.

In wiced_tcp_accept():

    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?

0 Likes

Hi Sam,

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.

thnx

vik86

0 Likes
Anonymous
Not applicable

Hi Vik86,

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().

Hi,

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?

Thanks,

Sung-Mok Lee

0 Likes

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

0 Likes