Java: Are concurrent reads and writes possible on a blocking SocketChannel via Object(In|Out)putStreams?

后端 未结 4 859
感情败类
感情败类 2021-02-08 17:28

I created an ObjectInputSteam and ObjectOutputStream on a blocking SocketChannel and am trying to read and write concurrently. My code is

4条回答
  •  再見小時候
    2021-02-08 18:25

    Interesting bug! You say though that you can't use FileChannel#transferTo. How about wrapping the I/O streams of the non-NIO socket into channels using Channesl#newChannel before passing to FileChannel#transferTo?

提交回复
热议问题