/** * Connect the socket. Called by MIOPListener. * * @param profile * @param time_out unused, we use SO_TIMEOUT */ @Override public void connect(Profile profile, long time_out) { if (!is_connected()) { if (profile instanceof MIOPProfile) { this.profile = (MIOPProfile) profile; } else { throw new org.omg.CORBA.BAD_PARAM( "attempt to connect an MIOP connection " + "to a non-MIOP profile: " + profile.getClass()); } try { socket = new MulticastSocket(((MIOPProfile) profile).getUIPMCProfile().the_port); socket.setSoTimeout(socketTimeout); socket.setTimeToLive(timeToLive); socket.joinGroup(((MIOPProfile) profile).getGroupInetAddress()); connection_info = socket.toString(); } catch (Exception e) { if (socket != null) { socket.close(); } throw new RuntimeException("Can't create multicast socket: " + profile); } connected = true; groupListener.start(); } }