Ethernet Test Demo
1 Demo overview
This demo shows how to implement Ethernet communication between the development board and a PC.
2 Preparation
Connect the PC and the board's Ethernet ports to the same switch via Ethernet cables.
In the board's terminal, run the following command to query the network interface's IP address. The result is shown below.
ifconfig
In the PC's terminal, run the following command to query the PC's network interface IP address. The result is shown below.
ipconfig
Run the ping command from both the board terminal and the PC terminal.
#在开发板终端
ping <PC端IP地址>
#PC终端
ping <开发板IP地址>
#e.g:ping 192.168.49.20If the result is as shown below, the network connection is working.

Open the software NetAssit under 04-Software Materials\Tools\Windows. Select TCP Client as the protocol type, enter the queried IP address as the remote host address, and select 8080 as the remote host port. The configuration screen is shown below.

3 Procedure
Open a terminal and copy the executable smdt_eth_demo from this demo's bin directory (05-Development Materials\Software Development Materials\linux_demo\smdt_eth_demo\bin) to the board's filesystem (the source code is available under the src path).
In the terminal, run the following commands to switch to the directory containing the smdt_eth_demo executable.
#切换到 smdt_eth_demo 可执行程序所在目录
cd ‘可执行文件所在目录’
#查看 smdt_eth_demo 是否在该目录下
lsIf the executable smdt_eth_demo is in the current directory, change its permissions.
#添加可执行权限
chmod +x smdt_eth_demoRun the following command; the board waits for the PC to connect. Click Connect in the NetAssit software. The result is shown below — the two devices have established an Ethernet connection and are waiting for user input.
./smdt_eth_demo
Three commands are available. recv: receive data sent from the PC; send: send data to the PC; exit: disconnect the Ethernet connection between the devices.
Type recv in the command line and press Enter to wait for the PC to send data. Enter "Hello SMDT" in the debugging assistant and click Send; the board receives the corresponding string, as shown below.

Type send in the command line and press Enter; the board sends "Hello ShiMetaPi" to the PC. The string sent from the board to the PC appears in the debugging assistant window, as shown below.

Type exit in the command line to disconnect the Ethernet connection between the two devices.

