Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
TCP 接続が終了したかどうかを知るにはどうすればよいですか? 私は を持っており、AsynchronousSocketChannelそれを開いた後、後で呼び出すたびにisOpen()結果はtrue.
AsynchronousSocketChannel
isOpen()
true
Web ブラウザからの TCP 接続を受け入れています。
TCP 接続は、IOException の書き込みまたは EOS の読み取りを取得するまでアップしています。isOpen() のような API は、接続状態については教えてくれません。ソケットやチャネルの状態、つまり自分で何をしたかについて教えてくれます。