Hi All,
I have been tasked with creating an interface to a PBX. The PBX (client) will connect to my application (Server). I have created a listener class that waits for
messages from the client.
this.serverSocket = new ServerSocket(this.serverPort);
clientSocket = this.serverSocket.accept();
Upon receipt of the message I spawn a thread that will handle that message.
new Thread(
new WorkerRunnable(
clientSocket, "MS: "+i)
).start();
From time to time I need to send messages to the client. What would be the best way to do this?
The client needs to ACK each message I send it.
I was thinking of creating a separate thread sendMsg(clientSocket) to handle this. So after I send my first message it (PBX) will ACK. Does this ACK stay in this thread or does it go to my listener class? If it goes to my listener class how do I know that the message I sent was ACKEed or some other message?
Thanks