I am currently translating the API from C # to Java, which has a network component.
The C # version seems to keep input and output streams and the socket open while using its classes.
Is it correct?
Given that the application sends commands and receives events based on user input, is it more reasonable to open a new socket stream for each "message"?
I support ServerSocket to listen on the server, throwing events, but I'm not sure if Socket and output stream support for outgoing messages is such a good idea.
I'm not used to programming socket. Like many developers, I usually work at the application level, when I need to do network interactions, and not at the socket level, and 5 or 6 years have passed since I did this at the university.
Cheers for the help. I think this is asking for more advice than for a definitive answer.
java network-programming
Omar kooheji
source share