32.2.5.8. Netx Duo Tcp Client
32.2.5.8.1. Overview
The netx duo tcp client example shows netx tcp client functions.
32.2.5.8.2. Board Setting
Connect an Ethernet port on PC to a RGMII port or a RMII port on the development board with an Ethernet cable and ensure that ‘SERVER-IPV4-ADDRESS’ is accessible.
32.2.5.8.3. Project Configuration
Ethernet Port Settings: Refer to Ethernet common project settings
By set(CONFIG_ECLIPSE_THREADX_NETXDUO_ADDONS_DHCP 1) in CMakeLists.txt, the DHCP will be enabled
When DHCP is enabled, make sure the tcp server SERVER_IPV4_ADDRESS is reachable.
32.2.5.8.4. Running the example
When the example runs successfully, it will try to connect SERVER_IPV4_ADDRESS : ECHO_SERVER_PORT (192.168.1.2:7777). Once connected, it will send message “ABCDEFGHIJKLMNOPQRSTUVWXYZ “ to the host. Then waiting for receive message from the host forever until it really receive one or server close the connection. It will print phy link status periodically until its status becomes Up . If received message, it will also print it to the console. If server close the connection, the receive function will return immediately. Following message is displayed in the terminal:
NetXDuo is running
IPv4 address: 192.168.1.223
Mask: 255.255.255.0
Enet phy init passed !
Link Status: Down
Link Status: Up
Link Speed: 1000Mbps
Link Duplex: Full duplex
Connecting to server: Connected
Receive response: abcdefg
Receive response: abcdefg
Receive response: abcdefg
Receive response: abcdefg
No response from server