Do Java sockets support full duplex?

后端 未结 2 1138

Is it possible to have one thread write to the OutputStream of a Java Socket, while another reads from the socket\'s InputStream, with

2条回答
  •  清歌不尽
    2020-12-01 08:01

    Yes, that's safe.

    If you wanted more than one thread reading from the InputStream you would have to be more careful (assuming you are reading more than one byte at a time).

提交回复
热议问题