Author: Ma Ning
Recently, a software network connection problem has left me alone. The problem itself is not complex, mainly because of different network settings. In the debugging process, I used several network monitoring tools under Windows CE to understand that Windows CE can also use the network monitoring tools we usually use to share them with you.
Environment Settings
I used the Windows CE 6.0 R2 environment for an experiment. For details about how to set up the development environment, refer:
Http://blogs.msdn.com/mikehall/archive/2009/06/10/steps-needed-to-install-windows-embedded-ce-6-0-from-scratch.aspx
We use device emulator as the test platform. The process of creating the OS design is not much said. For details, refer:
Http://blog.csdn.net/aawolf/archive/2007/12/19/1953448.aspx
It should be noted that sysgen_netutils must be added to OS design. If you select this option in catalog item, the selected network utilities (ipconfig, ping, route) and TCP/IP options (sysgen_tcpip) will also be added.
After the OS design is created and compiled, we need to deploy it on the device emulator. Set the appearance and network connection of device emulator, and select connectivity options. Red Circle position:
In the connectivity Options dialog box, select "device emulator (DMA)" for download and transport, select "kdstub" for debugger, and click the Settings button after download.
Set the resolution to 640 and 480 on the display page.
On the network page, select "enable ne2000 ..." Nic option. In this way, the network connection on the PC can be mapped to the ne2000 Nic of the device emulator. Note that the virtual pc nic driver needs to be installed on the PC. The simplest way is to install Virtual PC 2007.
At this point, we have configured the network configuration of the device emulator. Select attach device in the target menu, download the compiled NK. bin to the device emulator, and run it.
Ping Command
After the device emulator is started, we can debug it by entering the command. Select target control in the target directory, and command shell will appear. As shown in:
Run the ping command first. If we directly enter S to ping x. x, a command line window is displayed in the simulator and the execution result is output. S means to run an application in CE. The result is as follows:
However, the command line window automatically exits after the ping command is executed. To view the ping command execution, we need to be quick. Is there no other way?
Yes. Input s to ping x. x/d. The execution result is output to the output window.
In the following demonstration, I will post the results in the output.
Ipconfig command
Next is another simple network monitoring tool: ipconfig. Enter s ipconfig/All/d in command shell. /All is the ipconfig command that displays all the configuration information. In addition, there are two parameters:/renew and/release, which are used to update the IP address of the NIC. /D still displays the result in the output window.
PB debugger loaded symbols for 'd:/ninma/reldir/deviceemulator_armv4i_release/ipconfig. EXE'
122396 PID: 5860042 TID: 5890056 windows IP configuration
122465 PID: 5860042 TID: 5890056 Ethernet Adapter local area connection:
122465 PID: 5860042 TID: 5890056 IP address ......: 192.168.0.163
122465 PID: 5860042 TID: 5890056 subnet mask ......: 255.255.255.0
122465 PID: 5860042 TID: 5890056 IP address ......: fe80: 203: FFFF: fe55: 8d9f % 5
122465 PID: 5860042 TID: 5890056 default gateway...: 192.168.0.1
122465 PID: 5860042 TID: 5890056 adapter name ......: ne20001
122465 PID: 5860042 TID: 5890056 description ......: ne20001
122465 PID: 5860042 TID: 5890056 adapter index...: 2
122465 PID: 5860042 TID: 5890056 address ......: 00 03 FF 55 8d 9f
122465 PID: 5860042 TID: 5890056 DHCP enabled ......: Yes
122465 PID: 5860042 TID: 5890056 DHCP server ......: 192.168.0.1
122465 PID: 5860042 TID: 5890056 primary winsserver:
122465 PID: 5860042 TID: 5890056 secondary winsserver:
122465 PID: 5860042 TID: 5890056 lease obtained on: Sunday, July 5, 2009 18: 5: 30
122465 PID: 5860042 TID: 5890056 lease expires on: Sunday, July 12,200 9 18: 5: 30
122465 PID: 5860042 TID: 5890056 AutoConfig enabled: Yes
122465 PID: 5860042 TID: 5890056
122465 PID: 5860042 TID: 5890056 tunnel adapter []:
122467 PID: 5860042 TID: 5890056 interface number...: 4
122467 PID: 5860042 TID: 5890056
122468 PID: 5860042 TID: 5890056 tunnel adapter [6to4 pseudo-interface]:
122468 PID: 5860042 TID: 5890056 interface number...: 3
122468 PID: 5860042 TID: 5890056
122469 PID: 5860042 TID: 5890056 tunnel adapter [automatic tunneling pseudo-interface]:
122469 PID: 5860042 TID: 5890056 interface number...: 2
122470 PID: 5860042 TID: 5890056 IP address ......: fe80: 5efe: 192.168.0.163% 2
122470 PID: 5860042 TID: 5890056
122474 PID: 5860042 TID: 5890056 host name ......: WindowsCE
122474 PID: 5860042 TID: 5890056 domain name ........:
122474 PID: 5860042 TID: 5890056 DNS servers ......: 62.244.19.19
122474 PID: 5860042 TID: 5890056 192.168.0.1
122474 PID: 5860042 TID: 5890056 nodetype ......: 8
122474 PID: 5860042 TID: 5890056 routing enabled...: No
122474 PID: 5860042 TID: 5890056 proxy enabled ......: No
122474 PID: 5860042 TID: 5890056
PB debugger unloaded symbols for 'd:/ninma/reldir/deviceemulator_armv4i_release/ipconfig. EXE'
Netstat command
Next is netstat, which displays the current network status. Enter s netstat-E/d to display Ethernet statistics, such as the number of bytes sent and received.
PB debugger loaded symbols for 'd:/ninma/reldir/deviceemulator_armv4i_release/Winsock. dll'
273033 PID: 5120022 TID: 514005e
273035 PID: 5120022 TID: 514005e interface statistics received Ed sent
273036 PID: 5120022 TID: 514005e bytes 145754 14193
273036 PID: 5120022 TID: 514005e unicast packets 503 98
273036 PID: 5120022 TID: 514005e nonunicast packets 19 7
273036 PID: 5120022 TID: 514005e discards 0 0
273037 PID: 5120022 TID: 514005e Errors 0 0
PB debugger unloaded symbols for 'd:/ninma/reldir/deviceemulator_armv4i_release/Winsock. dll'
273037 PID: 5120022 TID: 514005e unknown protocols 0
273037 PID: 5120022 TID: 514005e name =
273037 PID: 5120022 TID: 514005e Index = 2
273037 PID: 5120022 TID: 514005e physical addrress = 0003ff558d9f
273037 PID: 5120022 TID: 514005e description = ne20001
273037 PID: 5120022 TID: 514005e type = 6
273037 PID: 5120022 TID: 514005e MTU = 1500
273037 PID: 5120022 TID: 514005e speed-BPS = 10000000
273038 PID: 5120022 TID: 514005e administrative status = 1
273038 PID: 5120022 TID: 514005e oprerational status = 5
273038 PID: 5120022 TID: 514005e output queue length = 0
PB debugger unloaded symbols for 'd:/ninma/reldir/deviceemulator_armv4i_release/netstat. EXE'
Enter s netstat-N/d to display the active TCP connection, including the address and port number:
471308 PID: 53a0062 TID: 53b0062 gettcptable.
471308 PID: 53a0062 TID: 53b0062
471308 PID: 53a0062 TID: 53b0062 UDP table
471308 PID: 53a0062 TID: 53b0062 loc ADDR loc Port
471309 PID: 53a0062 TID: 53b0062 0.0.0.0 137
471309 PID: 53a0062 TID: 53b0062 0.0.0.0 138
Enter s netstat-p tcp/d to display the information of the specified network protocol, as shown below:
1998793 PID: 5f0003e TID: 460006e TCP statistics:
1998793 PID: 5f0003e TID: 460006e --------------
1998793 PID: 5f0003e TID: 460006e active opens = 9
PB debugger unloaded symbols for 'd:/ninma/reldir/deviceemulator_armv4i_release/Winsock. dll'
1998793 PID: 5f0003e TID: 460006e passive opens = 0
1998793 PID: 5f0003e TID: 460006e connect attempt fails = 0
1998793 PID: 5f0003e TID: 460006e reset connections = 9
1998793 PID: 5f0003e TID: 460006e current connections = 0
1998793 PID: 5f0003e TID: 460006e segments received ED = 57
1998793 PID: 5f0003e TID: 460006e segments sent = 72
1998793 PID: 5f0003e TID: 460006e segments retransmitted = 2
1998793 PID: 5f0003e TID: 460006e errors pinned ED = 0
1998793 PID: 5f0003e TID: 460006e sgmnts sent w/reset flag = 12
1998793 PID: 5f0003e TID: 460006e cumulative connections = 0
1998793 PID: 5f0003e TID: 460006e time-out algorithm = 4
1998793 PID: 5f0003e TID: 460006e time-out minimim = 300
1998793 PID: 5f0003e TID: 460006e time-out maximum = 120000
1998793 PID: 5f0003e TID: 460006e maximum connections = dynamic (-1)
The-s option displays statistics of various protocols, such as IP, IPv6, ICMP, ICMPv6, TCP, tcpv6, UDP, and udpv6. -P can be used together with-s to display statistics of a certain protocol.
The-r option displays the route table information, which is similar to the route print command.
Route command
Enter s route print/d to display the current route table information:
2379153 PID: 4a5006a TID: 4bb0076 ================================================= ==============================================
2379153 PID: 4a5006a TID: 4bb0076 interface list
2379153 PID: 4a5006a TID: 4bb0076 0x2 00 03 FF 55 8d 9f ne20001
2379153 PID: 4a5006a TID: 4bb0076 ================================================= ==============================================
2379153 PID: 4a5006a TID: 4bb0076 ================================================= ==============================================
2379153 PID: 4a5006a TID: 4bb0076 active routes
PB debugger unloaded symbols for 'd:/ninma/reldir/deviceemulator_armv4i_release/Winsock. dll'
2379153 PID: 4a5006a TID: 4bb0076 the no. of entries is: 7
2379153 PID: 4a5006a TID: 4bb0076 destination netmask gatewayaddress interface Metric
2379153 PID: 4a5006a TID: 4bb0076 ----------------------------------------------------------------------------
2379153 PID: 4a5006a TID: 4bb0076 0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.163 30
2379153 PID: 4a5006a TID: 4bb0076 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
2379153 PID: 4a5006a TID: 4bb0076 192.168.0.0 255.255.255.0 192.168.0.163 192.168.0.163 30
2379153 PID: 4a5006a TID: 4bb0076 192.168.0.163 255.255.255.255 127.0.0.1 127.0.0.1 30
2379153 PID: 4a5006a TID: 4bb0076 192.168.0.255 255.255.255.255 192.168.0.163 192.168.0.163 30
2379153 PID: 4a5006a TID: 4bb0076 224.0.0.0 240.0.0.0 192.168.0.163 192.168.0.163 30
2379153 PID: 4a5006a TID: 4bb0076 255.255.255.255.255 255.255.255 192.168.0.163 192.168.0.163 1
2379153 PID: 4a5006a TID: 4bb0076 ================================================= ==============================================
In addition to the print command, route also has the add and delete commands. You can refer to the help of route, so we will not explain it much.
Tracert command
The tracert command is used to track the route from your device to an IP address. Enter s tracert www.sohu.com-P. It must be noted that the tracert result input parameter to output is-P.
Tracing Route to www.sohu.com [222.35.250.135]
Over a maximum of 30 hops:
2634835 PID: 27002de TID: 5650052 1
2634847 PID: 27002de TID: 5650052 5 MS
2634853 PID: 27002de TID: 5650052 6 MS
2634855 PID: 27002de TID: 5650052 1 MS
2635521 PID: 27002de TID: 5650052 192.168.0.1
2635521 PID: 27002de TID: 5650052
2636524 PID: 27002de TID: 5650052 2
2640537 PID: 27002de TID: 5650052 *
2640720 PID: 27002de TID: 5650052 179 MS
2640923 PID: 27002de TID: 5650052 203 MS
2641022 PID: 27002de TID: 5650052 222. 35 .*.*
2641022 PID: 27002de TID: 5650052
2641823 PID: 27002de TID: 5650052 3
2642038 PID: 27002de TID: 5650052 213 MS
2642241 PID: 27002de TID: 5650052 199 MS
2642444 PID: 27002de TID: 5650052 200 MS
2642543 PID: 27002de TID: 5650052 222. 35 .*.*
2642543 PID: 27002de TID: 5650052
2643345 PID: 27002de TID: 5650052 4
2643755 PID: 27002de TID: 5650052 406 MS
2643958 PID: 27002de TID: 5650052 202 MS
2644060 PID: 27002de TID: 5650052 102 MS
2644980 PID: 27002de TID: 5650052 222. 35 .*.*
2644981 PID: 27002de TID: 5650052
2645883 PID: 27002de TID: 5650052 5
2649895 PID: 27002de TID: 5650052 *
2650171 PID: 27002de TID: 5650052 273 MS
2650381 PID: 27002de TID: 5650052 205 MS
2656618 PID: 27002de TID: 5650052 222. 35 .*.*
Trace complete.
Now, we will introduce the network monitoring tool on Windows CE. We will continue to introduce netlog, another powerful network detection tool.
For more information about Windows Embedded ce development, see Windows Embedded ce Chinese R & D team blog: http://blogs.msdn.com/wincechina/