Listening to two ports simultaneously in Java server using multithreading

后端 未结 1 1851
长情又很酷
长情又很酷 2021-01-25 02:06

I am building a simple Java server which simultaneously listens for client request on two ports simultaneously using two ServerSocket instances. Here is the code for Server:

相关标签:
1条回答
  • 2021-01-25 02:31

    PrintWriter is buffered by defaut. Add a writer.flush() (or even better a close() since you're not using the stream anymore) after writer.println().

    0 讨论(0)
提交回复
热议问题