Connect two client sockets

前端 未结 12 1484
执笔经年
执笔经年 2020-12-10 03:58

Let\'s say Java has two kind of sockets:

  • server sockets \"ServerSocket\"
  • client sockets or just \"Socket\"

Imagine the situation of two

12条回答
  •  伪装坚强ぢ
    2020-12-10 04:37

    Are you trying to created a mocked socket ? If so, mocking both sides of the pipe may be a bit more complicated than necessary.

    On the other hand, if you just want to create a data pipe between two threads, you could use PipedInputStream and PipedOutputStream.

    However, without more information about what your trying to accomplish, I cannot tell you if either of these choices is a good fit or if something else would be better.

提交回复
热议问题