Can Socket() class listen for messages from a remote server
843790May 5 2009 — edited May 7 2009I am writing a small Java app which needs to connect to several remote servers.
At various intervals each of these servers will send messages to one of their ports, regardless of whether anything is listening or not.
Using the Socket() Class I have been able to write a program which connects to one of the server ports, then requests and receives some of the data.
But I really need this client program to act as a listener, in the way that ther ServerSocket() class does.
A crude solution I came up with involved an infinite loop, Although it sort of worked, it also caused the CPU to max out.
Does anyone know if there is a method which allows the Socket() class to listen for messages from a remote server?
Edited by: A-Marquis on May 5, 2009 3:15 AM