cancel
Showing results for 
Search instead for 
Did you mean: 

How to tune azure netxduo to receive more incoming connections?

Eakyo.1
Associate III

Hello,

I am using the stm32h563 processor in my project. I made a TCP Server application using the ethernet connections of this processor and I was able to run it as I wanted. But I saw that it could not connect to another client over the same IP address without breaking the connection with one client. Even though I set the NX_MAX_PHYSICAL_INTERFACES defined value to two, there was no change. Also, in the files I shared, it is said that we can make a tcp server and 2 tcp client connections and open a separate socket for each (1).

 

After some research, I realized that this problem can be solved with lwip + freertos. Below are examples of these solutions. How can I make a similar solution on Azure RTOS Netx side?
Our problem with lwip + freertos solved community issue(2) was previously shared and the solution was "By tweaking the options in lwipopts.h, it should be possible to receive more incoming connections: MEMP_NUM_TCP_PCB, MEMP_NUM_TCP_PCB_LISTEN, MEMP_NUM_NUM_NETCONN, etc... " was returned as ".

As a similar header you can see the extension(3) under the References header.

 

References:

(1)Understand Azure RTOS NetX Duo | Microsoft Learn

(2)Solved: How to tune LwIP to receive more incoming connecti... - STMicroelectronics Community

(3) I hope to achieve one-to-many connections using TC... - STMicroelectronics Community

 

Best Regards

Eren Akyol

1 ACCEPTED SOLUTION

Accepted Solutions
STea
ST Employee

Hello  @Eakyo.1 ,

I've prepared a small template file app_netxduo.c from which I was able to send data with multiple clients on the same IP address and port.

STea_0-1719507529388.png

Find attached the template File and confirm if this what you need to do.
Regards


In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

13 REPLIES 13
STea
ST Employee

Hello @Eakyo.1 ,

I need to get more insights to help you with your further implementation of Netxduo .

are you using the following API call to accept an incoming client connection:

NX_TCP_SOCKET client_socket;

nx_tcp_server_socket_accept(&server_socket, &client_socket, NX_WAIT_FOREVER);

then you should create a new thread to handle the client connection with :

tx_thread_create(.....);

if it is the case could you explain the exact behavior from STM32 side when trying to connect the new client .

BR

Hichem

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello @STea ,

Actually, if you run the TCP/IP Server Echo application from the link I shared below, only one client connects to the defined IP and Port. Despite setting the NX_MAX_PHYSICAL_INTERFACES value to 4 and calling the "nx_ip_interface_attach" function, only one client can still connect in the TCP/IP Server Echo application; only one client can connect at a time. The requirement of my project is that multiple clients can send queries to a single IP and Port.

https://github.com/STMicroelectronics/STM32CubeH5/tree/main/Projects/STM32H573I-DK/Applications/NetXDuo/Nx_TCP_Echo_Server

Hello @Eakyo.1 ,

Can you please share the code in which you are declaring and binding you TCP sockets. I assume it's located in your app_netxduo.c.

Regards

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello @STea ,

I am working with the STM32H573I-DK board. On this board, I am directly running the Nx_TCP_Echo_Server project from https://github.com/STMicroelectronics/STM32CubeH5/tree/main/Projects/STM32H573I-DK/Applications/NetXDuo. That is, the app_netxduo.c file can be found at the following link:

https://github.com/STMicroelectronics/STM32CubeH5/blob/main/Projects/STM32H573I-DK/Applications/NetXDuo/Nx_TCP_Echo_Server/NetXDuo/App/app_netxduo.c

Regards

Hello @Andrew Neil ,

I cannot solve the problem. Therefore, I asked two different questions.

Regards

But they are the same question, surely?

The same question, but lwip + freertos provides this solution. I asked a new question to explain it more simply and reach a solution. Additionally, you can use this for comparison. 'Solved: How to tune LwIP to receive more incoming connecti... - STMicroelectronics Community.

STea
ST Employee

Hello @Eakyo.1 ,

In order to achieve multiple socket TCP connection, you need to create a thread for each socket, and you need to adjust some parameters to make for the Nextduo pool sizes as well as passing the Port or an index (as attached) to handle multiple connection ...

bellow you will find both app_netxduo.c and app_netxduo.h which I used to test this is working.

as you mentioned for the Lwip solution for number of sockets that should be increased the parameter for Nexduo is #define MAX_TCP_CLIENTS 5 (example)

Regards

 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.