2024-01-31 06:51 AM
Hello,
I have created and executed a TCP server project with Azure NetX library using Ethernet. Additionally, I need multihome support in this project. I want multiple clients to connect to a device with a static IP. Can you assist me with this?
Best regards,
Eren Akyol
2024-01-31 11:36 PM
status = _nx_ip_interface_attach(&ip_0, "port_2", IP_ADDRESS(0, 0, 0,0), 0xFFFFFF00UL, my_netx_driver);
Function is not working. You can look at the Chapter 2 - Installation and use of Azure RTOS NetX DHCP Client | Microsoft Learn .
2024-02-12 11:20 AM - edited 2024-02-12 11:20 AM
Hello @Eakyo.1 ,
try to implement it with 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(.....);
BR
2024-02-18 09:58 PM
First of all, thank you for your feedback.
The extension I shared is the tcp server echo example. The structure you mentioned is already used in this example, but this example does not work with multiple clients connected to a single ip address. It works only depending on one client. I need to connect multiple clients.
2024-02-22 10:03 AM
Hello @Eakyo.1 ,
from my understanding you need to implement a server with the capability of accepting connection from multiple client on the same STATIC IP_ADDRESS is that your use case because if it is the case i think that the NetxDuo API support the implementation of such usecase this can be done by accepting a client then upon accepting create a thread to deal with that client .
this is the quote from the NETX documentation listing the steps :
NetX Duo supports systems connected to multiple physical devices using a single IP instance. Each physical interface is assigned to an interface control block in the IP instance. Applications wishing to use a multihome system must define the value for NX_MAX_PHSYCIAL_INTERFACES to the number of physical devices attached to the system, and rebuild NetX Duo library. By default NX_MAX_PHYSICAL_INTERFACES is set to one, creating one interface control block in the IP instance.
The NetX Duo application creates a single IP instance for the primary device using the nx_ip_create service. For each additional network devices, the application attaches the device to the IP instance using the nx_ip_interface_attach service.
Each network interface structure contains a subset of network information about the network interface that is contained in the IP control block, including interface IPv4 address, subnet mask, IP MTU size, and MAC-layer address information.
for further detail refer to the official documentation in this link .
BR