- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using wiced_tcp_server_start() to implement my tcp server.
I hit a hang up issue (not able to make new connection) if I have more
than 5 connections, I cannot connect to the server any more.
The connected connections still work, but new connection always fails.
I try to close all connected connections, but still not able to connect
to the server any more.
I've no idea why this happens with more than 5 connections.
I increase WICED_DEFAULT_TCP_LISTEN_QUEUE_SIZE to 10.
Increase WICED_MAXIMUM_NUMBER_OF_ACCEPT_SOCKETS and
WICED_MAXIMUM_NUMBER_OF_SOCKETS_WITH_CALLBACKS to 10.
The issue still happens with more than 5 connections.
Test on SDK-3.1-beta1, FreeRTOS+LwIP build.
Looks like a SDK bug. comments?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I wrote a simple test program to test this issue.
The tcp server listen on port 23, so we can use telnet client to test it.
In normal case, we should get below response:
$ telnet 192.168.1.103
Trying 192.168.1.103...
Connected to 192.168.1.103.
Escape character is '^]'.
However, when connect 5 or 6 clients at the same time,
the clients are not able to connect to the server any more.
(This issue is 100% reproducable)
Event I close all connections, it still not able to connect to the server.
I mean *any new connections* will fails!!
$ telnet 192.168.1.103
Trying 192.168.1.103...
I can also observe the similar hangup issues with the http server on sdk-3.1
because it also uses wiced_tcp_server_start() to implement the server.
Note, I have tested LwIP/NetX/NetX_duo, and found this issue only happens on LwIP.
But it is critical because the result is a non-response server.
Attached the test_server.c
I use ping_powersave snip to test it.
You can modify apps/snip/ping_powersave/ping_powersave.c
and add start_test_server(); before the while loop to call send_ping();
Add extern wiced_result_t start_test_server(); before application_start().
Add test_server.c to makefile.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As per the release notes:* Concurrent AP & STA mode (AP mode limited to 5 concurrent connected clients)
Yes. This is a known limitation on the IOT module. We don't see the need or have memory resources to connect more clients.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Gangi,
I think you missed my point.
It's ok to limited to 5 concurrent connected clients.
And it's ok to reject 6th connection.
However it's not acceptable the 6th connection makes the tcp server
not able to be connected any more.
After this issue happen, even though I discconect all clients,
it still not able to connect to the server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for clarification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
WIth FreeRTOS+LwIP build, I can confirm that the hangup happens when
internal_tcp_server_find_free_socket() returns ERROR.
I think the SDK need to properly handle this case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Same issue here both with Web server and with a home built Modbus/TCP server. It is unacceptable that the stack just stops working when the number of clients goes over the limit. Has this been fixed? Are there work-a-rounds? We are unable to put or module into production until we get this resolved. What are the limitations when using just STA or just AP mode alone? Can I expect similar issues in those cases?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have sames case in SDK 3.1.2
6th connection is rejected. It is OK that only 5 connection is possible.
But, when after 6th connection tried from client, then TCP server socket became unstable.
and it needs reboot the module.
1. Server get 5 connection.
2. Remote device tried to connect to this TCP server
- this time, 1st connection is disconnected.
- Server socket is not controlled as expected.
==> Main point is that 6th TCP connection make trouble.
SDK :
I think that connection is already 5th, 6th connection should be rejected in somewhere or IP stack
then this problem will be solved.
TKS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my case, I just made work-around,
- SDK 3.1.2 / FreeRTOS+LwIP ( For LwIP, this supports callback function well, so we prefer this OS)
- To prevent 6th connection and module hangup
- Just keep 4 ea of TCP connection and when get connection callback then ignore it.
( ignoring is not ease, so just get accept and make it disconnect )
- my work-around code
uint8_t add_tcp_tcp_server_sockets( uint8_t para_interface, wiced_tcp_socket_t *para_socket, test_tcp_server_event_t operation )
{
uint8_t i; wiced_result_t ret;
if(operation == SOCKET_CONNECT_EVENT)
{
ret = wiced_tcp_server_accept( &ex_tip[para_interface].tcp_server, para_socket );
if ( ret != WICED_SUCCESS ) { WPRINT_APP_INFO(("Accept Failed\r\n")); return 0; }
// so I reject 5th connection and keep total connection total as 4
if(ex_tcp_server_conntected_device_count[para_interface]== (MAX_CONN-1)) //MAX_CONN =5
{
wiced_tcp_server_disconnect_socket( &ex_tip[para_interface].tcp_server, para_socket );
return 0;
}
}
|
|// this may works fine.