《Disney +》 迪士尼、Marvel、彼思、星球大戰…  Nintendo Switch版LEGO Marvel Super Heroes 12月16日發售!   《巴蘭的異想奇境》體驗版於1/28開放下載! 可獲得遊玩特典──能在正式版使用的隱藏服裝!   Niantic × 任天堂 再次合作!「皮克敏Pikmin」的新APP發表!開始接受事前登錄!   編集部實機測試!手把手教你初期設定「PlayStation 5」   深入了解PS5的遊戲輔助功能   日本知名Cosplayer紫花菫於「Tales of」系列官方頻道參加演出!   玩家販賣DOAXVV脱衣魔改影碟 日本玩家被捕將遭起訴   《Bloodhunt》將在 2021 年於 PlayStation 5 推出 

nc 如何 STDIN 結束就關閉

商業

使用 nc 連接 socket 端,就會一直咬在那邊,但是想要命令執行完成就結束,該怎麼做呢?

nc 如何 STDIN 結束就關閉

nc 可以靠下述兩個參數來達成:

  • -q seconds after EOF on stdin, wait the specified number of seconds and then quit. If seconds is negative, wait forever.
  • -w secs timeout for connects and final net reads

範例

  • echo "test" | nc -q 1 localhost 11211
  • echo "test" | nc -w 3 localhost 11211

相關網頁

Tsung

隨機商業新聞

Disney+