I have programmed (in JAVA) a socket using simple examples in the web. I can either send or listen at one time - as far as I understood.
Isn't there a possibility where I can send/listen/receive full duplex?
Thank you very much.
I have programmed (in JAVA) a socket using simple examples in the web. I can either send or listen at one time - as far as I understood.
Isn't there a possibility where I can send/listen/receive full duplex?
Thank you very much.
The TCP/IP channel is full duplex in its nature. You just have to use another thread (on the client side as well as server side) to check the availability of data.
I would like to share with you guys the code repo. It is really simple, you can get the idea to make your stuff work. It is an elaborate example. The steps accidentally look like Ordous's solution.
https://github.com/khanhhua/full-duplex-chat
Feel free to clone! It's my weekend homework.
You can send and receive using two different threads. If you have one thread reading you can have another writing. The reading thread need to be waiting all the time if you use a blocking socket. You only need a writing thread when you have something to send.