/** * Sends a message to all the established connections. This is usually used to send out our own * messages such as search requests. Note that this method does NOT add the message to the list of * seen messages. This may cause certain messages not to be fired off to listeners. * * <p>If there is an error sending the message through a particular connection, the error will be * ignored and the message will continue to be sent to all the other connections. */ public void sendMessageToAll(GnutellaMessage msg) { synchronized (establishedConnections) { int size = establishedConnections.size(); GnutellaConnection connection; for (int i = 0; i < size; i++) { connection = (GnutellaConnection) establishedConnections.get(i); try { connection.send(msg); } catch (SendMessageFailedException ex) { // ignore message sending failures } } } }