First, I am quite new with the use of Socket communication, so there still some things that I don’t know. I understand the basics of Socket communication in Java, so I seeking for guide here.
Now, about my problem, I will need to build a server socket communication with a remote application. In my application I will run the serverSocket to which the Client on the other application will communicate with me. Part of the protocol implemented for this communication is that this socket has to be opened all the time, this provide us of a one perpetual channel of communication between both applications.
Nothing very estrange so far. The problem is that I am going to need to use mi serverSocket to start the conversation with the Client. This means that my serverSocket will need to send some information to the client without the client having requested for it.
For definition I understand that serverSockets are threads that are waiting for a Client to open a connection with them, once established this connection the conversation between the applications normally start with some request (i.e. an ENQ character) from the Client to start the information exchange; this is for the cases that there is some protocol implemented to validate, send and receive data. Otherwise, the information is send by the client without great validation and control.
In a normal case my problem would be handled in a more natural way if mi application could use a Client to communicate to a serverSocket on the remote application. But this is not the case. The remote application cannot have a serverSocket, it can only have a Client (Don’t ask me why, this is the application of a business partner, not my own, and for the moment they are not willing to change their communication scheme).
With this in mind, my question is: There is a way that I could use my running and waiting serverSocket to send some information from my application to the remote Client whenever a process in my application need to? how I call from a third bean in my application the open socket in the serverSocket to write on it?