《Disney +》 迪士尼、Marvel、彼思、星球大戰…  新咒術打卡位!1011 SIPTEA x《咒術迴戰》買飲品付送咒術週邊產品   置身於未來!官方宣布推出PS5全新VR控制器!   尤菲的極限爆發曝光!「FINAL FANTASY VII REMAKE INTERGRADE」、「尼祿」、「史卡蕾特 & 緋紅夢魘」美術圖以及新戰鬥系統「聯手模式」大公開!   下一集 State of Play 帶你踏入西方禁地   下一次會是什麼「之鬪」呢?數位卡夫特實施新遊戲問卷調查!   OlliOlliWorld:新的炙岩生物群落現已揭曉,已確認PS5採用120fps   真‧電競能量飲!?「ZONe PlayStation 5 edition Ver.PS5」喝給你看!   《Godfall》現已登陸PS4,同時推出全新「Fire & Darkness」擴充內容 

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 Plus