Sockets and ClassLoader

I'm trying to connect multiple clients to a server using the same port. Each client is loaded by a different ClassLoader, but they are all calling the same code.

The first one connects just fine, every one after that I get a Connection Timed Out exception.

The place where it hangs is:

public static Socket createSocket()

throws IOException

{

return new Socket(server.ip.address, 7468);

}

Any suggestions on why the first one works and the rest fail?

[506 byte] By [rwbrusha] at [2007-10-2 20:09:45]
# 1
are you starting a new thread at the server for each accepted connection?But even without that you should still be able to form 50 connections before getting this condition ...
ejpa at 2007-7-13 22:50:16 > top of Java-index,Archived Forums,Socket Programming...
# 2
No, the server just listens on that port.I'm thinking it has something to do with Spring since the app that is starting all these clients is being run with Spring through activemq and if I pull it out of all that it seems to work fine.
rwbrusha at 2007-7-13 22:50:16 > top of Java-index,Archived Forums,Socket Programming...
# 3
The server must call ServerSocket.accept() somewhere, what does it do next? process the socket inline or start a thread?
ejpa at 2007-7-13 22:50:16 > top of Java-index,Archived Forums,Socket Programming...
# 4

The server starts a thread that just accepts any connections then adds a listener to what comes in over the socket.

Thread t = new Thread(new Runnable() {

public void run() {

try {

for (;;) {

Socket s = serverSocket.accept();

acceptSocket(s);// Adds Listener

}

}

catch (IOException ioe) {

log("notifier thread: I/O exception: " + ioe, ioe);

}

catch (Throwable thr) {

log("notifier thread: internal error: " + thr, thr);

}

try {

serverSocket.close();

}

catch (IOException iox) {

}

}

});

rwbrusha at 2007-7-13 22:50:16 > top of Java-index,Archived Forums,Socket Programming...
# 5
and what's a listener? is it a separate thread?
ejpa at 2007-7-13 22:50:16 > top of Java-index,Archived Forums,Socket Programming...