[code小心得]&工作小心得



變數型態的長度 #include int main(void) { printf("int : %d\n",sizeof(int)); printf("short : %d\n",sizeof(short)); printf("char : %d\n",sizeof(char)); printf("unsigned int : %d\n",sizeof(unsigned int)); printf("long : %d\n",sizeof(long)); printf("long long: %d\n",sizeof(long long)); printf("float : %d\n",sizeof(float)); printf("double : %d\n",sizeof(double)); printf("long double : %d\n",sizeof(long double)); return 0; } iperf 專門被用來做頻寬吞吐量測試

一邊做server,另一邊做client,做頻寬傳輸測試。

讓開發版使用的交叉編譯可以參考這篇
[Linux] 將 iperf 導入嵌入式系統 Router

參數說明
-s 以server模式啟動,eg:iperf -s
-c host以client模式啟動,host是server端地址,eg:iperf -c 222.35.11.23

通用參數
-f [k|m|K|M] 分別表示以Kbits, Mbits, KBytes, MBytes顯示報告,默認以Mbits為單位,eg:iperf -c 222.35.11.23 -f K
-i sec 以秒為單位顯示報告間隔,eg:iperf -c 222.35.11.23 -i 2
-l 緩衝區大小,默認是8KB,eg:iperf -c 222.35.11.23 -l 16
-m 顯示tcp最大mtu值
-o 將報告和錯誤信息輸出到文件eg:iperf -c 222.35.11.23 -o c:\iperflog.txt
-p 指定服務器端使用的端口或客戶端所連接的端口eg:iperf -s -p 9999;iperf -c 222.35.11.23 -p 9999
-u 使用udp協議
-w 指定TCP窗口大小,默認是8KB
-B 綁定一個主機地址或接口(當主機有多個地址或接口時使用該參數)
-C 兼容舊版本(當server端和client端版本不一樣時使用)
-M 設定TCP數據包的最大mtu值
-N 設定TCP不延時
-V 傳輸ipv6數據包
server專用參數
-D 以服務方式運行ipserf,eg:iperf -s -D
-R 停止iperf服務,針對-D,eg:iperf -s -R
client端專用參數
-d 同時進行雙向傳輸測試
-n 指定傳輸的字節數,eg:iperf -c 222.35.11.23 -n 100000
-r 單獨進行雙向傳輸測試
-t 測試時間,默認10秒,eg:iperf -c 222.35.11.23 -t 5
-F 指定需要傳輸的文件
-T 指定ttl值

針對IPv6部分,可透過以下指令來達成:

Server side:
$ iperf -s –V

Client side:
$ iperf -c <server address="" ipv6=""> -V</server>



那如果要針對 寫MAC等 可以考慮使用 iwpriv 這個指令。

留言