Hello,
today I have started with Java NIO, but it seems to be quite complex, hence I have some questions to which I couldn’t find any answer in those NIO tutorials I have read.
For learning purposes I want to implement some very common use cases:
- Sending serialized objects to a server, deserializing and storing them in a collection.
- Requesting data from a server. The data could be anything, maybe some objects in an array.
I don’t understand how ObjectInputStream/ObjectOutputStream and ByteBuffer work together and I’m not sure how many channels I need on the client and on the server. Do I need one socket channel on each side for each use case (4 socket channels altogether) or would one read-write-socket channel on each side be sufficient?
Thanks for all answers.