Socket Events in Java
Posted on 2005-03-08
Here is what I'm trying to acheive in terms of retrieving data from sockets connections to my server.
The server can accept multiple socket connections. And as soon as it gets a socket connection it hands it off to a ProcessSocket class which extends Thread.
in the ProcessSocket class I basically do the following
DataInputStream din = new DataInputStream(new BufferedInputStream(socket.getInputStream()));
byte mesg  = new byte;
I feel this is a bad way to monitor a socket for any incoming data. Is there an way I can look for events on a socket when there is data with a third party API maybe? Can someone suggest a better way to do this in Java?
And also what is the limit on how many incoming socket connections a JVM allows to an application?
Any help is appreciated.