Well, I am working on a project where I need to write a TCP / IP client-server program. Well, actually it's pretty simple, but I was asked to do something that I had never done before.
I want to know if I can write a Java client application that sends commands to the server and receives a response from the server. In addition, the Server can send the same commands to the client and receive similar responses.
Simply put, I am asked to write an application in which the Client is simultaneously a server (not for him, but for the server to which he connects) and vice versa.
For example, if the Client requests the video stream of camera 01 to the server, the server sends a confirmation. Immediately after that, if the server wants, it can send a request to view camcorder 02 to the client, and the client will also respond accordingly.
Can this be done?!? If so, please, some tips will be great, as I'm not sure how to deal with this, possibly multithreading. If so, how?!? Some help will be great.
source share