Linux
ncat 在 100 個 UDP 數據包後停止偵聽
我在 1 秒後不斷向 UDP 伺服器發送數據包。偵聽 UDP 數據包:
ncat -klup 1234 --sh-exec "cat > /proc/$$/fd/1"
但是,在列印 100 個數據包後,沒有其他內容列印。使用 Wireshark,我可以看到數據包仍在發送,但在伺服器端沒有列印。
$ ncat -klup 1234 --sh-exec "cat > /proc/$$/fd/1" Hello Server! 1 Send 2 Send 3 Send 4 Send 5 Send 6 Send 7 Send 8 Send 9 Send 10 Send 11 Send 12 Send 13 Send 14 Send 15 Send 16 Send 17 Send 18 Send 19 Send 20 Send 21 Send 22 Send 23 Send 24 Send 25 Send 26 Send 27 Send 28 Send 29 Send 30 Send 31 Send 32 Send 33 Send 34 Send 35 Send 36 Send 38 Send 39 Send 40 Send 41 Send 42 Send 43 Send 44 Send 45 Send 46 Send 47 Send 48 Send 49 Send 50 Send 51 Send 52 Send 53 Send 54 Send 55 Send 56 Send 57 Send 58 Send 59 Send 60 Send 61 Send 62 Send 63 Send 64 Send 65 Send 66 Send 67 Send 68 Send 69 Send 70 Send 71 Send 72 Send 73 Send 74 Send 75 Send 76 Send 77 Send 78 Send 79 Send 80 Send 81 Send 82 Send 83 Send 84 Send 85 Send 86 Send 87 Send 88 Send 89 Send 90 Send 91 Send 92 Send 93 Send 94 Send 95 Send 96 Send 98 Send 99 Send 100 Send 101 Send
無論我嘗試多少次,總是在 100 個數據包後停止。
在ncat(1)手冊頁中說明
-m numconns, --max-conns numconns (Specify maximum number of connections) The maximum number of simultaneous connections accepted by an Ncat instance. 100 is the default (60 on Windows).
100 是預設的最大連接數。它可以用
-m
標誌來修改。