Windows Embedded下的網絡監測工具(三)
Netstat命令
接下來是netstat,顯示網絡當前的狀態。輸入s netstat -e /d,顯示以太網的統計數據,比如發送和接收到的字節數等。
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 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'
輸入s s netstat -n /d,會顯示當前活動的TCP連接,包括地址和端口號:
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
輸入s netstat -p tcp /d,會顯示指定網絡協議的信息,如下:
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 = 57
1998793 PID:5f0003e TID:460006e Segments Sent = 72
1998793 PID:5f0003e TID:460006e Segments Retransmitted = 2
1998793 PID:5f0003e TID:460006e Errors Received = 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)
-s選項顯示各種協議的統計信息,比如IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP和UDPv6協議。-p可以和-s共同使用,用于顯示某種協議的統計信息。
-r選項則顯示路由表信息,與后邊的route print命令類似。
Route命令
輸入s route print /d,顯示當前的路由表信息:
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
Route除了print命令外,還有Add和Delete命令。大家可以參考Route的幫助,我們就不多解釋了。
Tracert命令
Tracert命令用于跟蹤你的設備到某個IP地址的路由。輸入s Tracert www.sohu.com –p,需要說明的是,Tracert結果輸入到output的參數是-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.
好了,對于Windows CE上的網絡監測工具,我們就先介紹到這里。我們將在后邊繼續介紹另一個功能強大的網絡檢測工具——netlog。
更多關于Windows Embedded CE開發的文章,請參考“Windows Embedded CE 中國研發團隊”的中文博客:http://blogs.msdn.com/wincechina/
【編輯推薦】