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

13 REPLIES 13
Eakyo.1
Associate III

Hello @STea ,

First of all, thank you very much for your help. In the example you provided, 2 different clients can connect to 2 different ports with the same IP. Actually, what I've been trying to explain from the beginning is that 2 different clients should be able to connect to a single port with the same IP. Do you have any suggestions for this?

Regards

Hello @Eakyo.1 ,

To allow multiple clients to connect to a single server port, you typically use a single listening socket that accepts incoming connections. Each accepted connection is then handled by a separate socket. This is a common pattern in TCP server design. is this what you are trying to do?

In that case you need to:

  1. Create a Listening Socket: This socket listens for incoming connection requests on the server port.

  2. Accept Connections: When a client attempts to connect, the server accepts the connection, which creates a new socket specifically for communicating with that client.

  3. Handle Client Communication: The server communicates with the client using the newly created socket. This communication is often handled in a separate thread or by using asynchronous I/O to allow the main listening socket to continue accepting new connections.

  4. Manage Multiple Connections: If you want to handle multiple connections simultaneously, you can create a new thread for each accepted connection, or you can use a select/poll mechanism to manage multiple sockets within the same thread.

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

Hello @STea ,

Yes, this is exactly what I wanted. Thank you very much for your help.

Regards