The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

Re: Mina networking

Something like this using Java SE classes and methods: An infinite loop that gets a connection/socket, creates a new object to handle that socket and then loops back to await the next connection

while(true) {
socket = serverSocket.accept(); // Get a socket
new TheConnectionHandler(socket); // pass the reference to the socket to an object to handle the communications
} // end loop go back to the accept() method to wait for the next connection

Re: Mina networking

Originally Posted by Norm

Something like this: An infinite loop that gets a connection/socket, creates a new object to handle that socket and then loops back to await the next connection

while(true) {
acceptor = new SocketAcceptor(); // Get a socket
new ConnectionHandler(acceptor); // pass the reference to the socket to handle the communications
} // end loop go back to the accept() method to wait for the next connection