0.PCATTCP簡介
PCATTCP的前身為Test TCP,Test TCP是BSD作業系統的原生工具,該工具通過控制台輸入參數,用於測試TCP或者UDP的通訊速度。該項目於1984年啟動,現在該工具的原始碼早已開放。PCATTCP是Test TCP的windows移植版本,是一個用於測試TCP和UDP通訊速度的windows控制台程式。
1.PCTATCP的安裝 【1】下載可執行檔和原始碼包,下載網址 【2】解壓可執行檔到某檔案件,例如D:\tools 【3】把D:\tools加入環境變數PATH中
2.簡單測試 測試需要兩台裝置參與,開始之前需記錄兩台裝置的IP地址。例如在本例中的兩台裝置。 裝置A 伺服器端 IP地址為192.168.1.103 裝置B 用戶端 IP地址為192.168.1.102 其中裝置A通過網線接入路由器,裝置B通過Wifi接入路由器。
【裝置A】控制台中輸入 pcattcp -r -c 參數-r表示伺服器端模式,該裝置處於接收狀態。 參數-c表示該裝置工作於連續模式。 控制的輸出入下圖所示,從圖中的反饋資訊可以看出,pcattcp工作於5001連接埠。也可通過-p參數修改指定連接埠。
圖1 裝置A工作於伺服器模式
【裝置B】控制台中輸入 pcattcp -t 192.168.1.103 -t 用戶端模式,發送。
圖2 裝置B工作於用戶端模式 輸入命令之後,PCATTCP工具通過網路發送一些列資料包,預設情況下,單個資料包的大小為8192,資料包的個數為2048。此時,從裝置B到裝置A的TCP傳輸速度為2311.71KB/s。
3.修改參數 在一般測試過程中往往存在限制,例如資料包的長度的限制或者資料包個數的限制,此時便可利用-l和-n參數。 pcattcp -t -l 1024 -n 1024 192.168.1.103 -t 用戶端模式,發送。 -l 被傳輸的資料包大小,此時單個資料包的長度為1024,預設大小為8192。 -n 發送資料包個數,此時重複資料包的個數為1024,預設資料包個數為2048。
圖3 修改資料包長度和資料包個數
4.參考資料 【1】 官方介紹和使用說明 【2】pcattcp指令活命
pcattcp -hPCAUSA Test TCP Utility V2.01.01.13 (IPv4/IPv6) Usage: pcattcp -t [-4|-6] [-options] host [ < in ] pcattcp -r [-4|-6] [-options > out]Common options: -4 use IPv4 (default) -6 use IPv6 -l ## length of bufs read from or written to network (default 8192) -u use UDP instead of TCP -p ## port number to send to or listen at (default 5001) Can specify multiple sequential ports two ways: -p #first-#last -p #first+#additional -s toggle sinkmode (enabled by default) sinkmode enabled: -t: source (transmit) fabricated pattern -r: sink (discard) all received data sinkmode disabled: -t: reads data to be transmitted from stdin -r: writes received data to stdout -A align the start of buffers to this modulus (default 16384) -O start buffers at this offset from the modulus (default 0) -v verbose: print more statistics -d set SO_DEBUG socket option -b ## set socket buffer size (if supported) -f X format for rate: k,K = kilo{bit,byte}; m,M = mega; g,G = giga -c -t: send continuously -r: accept multiple connections sequentially -a bind to local host interface IP addressOptions specific to -t: -n ## number of source bufs written to network (default 2048) -D don't buffer TCP writes (sets TCP_NODELAY socket option) -w ## milliseconds of delay before each write (default 0) -R ## desired transmit data rate in bytes/secondOptions specific to -r: -M concurrent TCP/UDP multithreaded receiver -B for -s, only output full blocks as specified by -l (for TAR) -T "touch": access each byte as it's read