I have a written a Server Socket which connects to back end socket and receiving the data and sending back to the front end. But as per my client requirement i need to create only one socket at the back end. But the code I have written is creating new sockets for each request. Is there any way to use the single client socket connection for all the transactions. I have attached the sample code for the reference.
serversocket = new ServerSocket(1001);//create socket
clientsoc = new Socket("10.100.53.145",200);
socket_channel = clientsoc.getChannel();
System.out.println("Socket could not be created "+e);
Will it reset the Server Socket thread or Client Socket ? Because in my case multiple socket connections is getting created at the client side where I used to create the Client Socket. Because the variable "fromclient" is used to accept the connections from the server socket. Is that I have to use the variable "clientsoc" for that ?