0 Replies Latest reply on Feb 24, 2003 1:36 PM by Chuck Emary

    NAT UIL

    Chuck Emary Newbie

      In regards to this thread:
      http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ someone confirm/deny that the patch mentioned in
      the referenced thread has indeed been applied in the following code, UILServerIL::createConnection(), in the form of LOCAL_ADDR, LOCAL_PORT? This was pulled from the 3.0.2beta3 release. TIA for any thoughts or help.

      Chuck

      /**
      * Used to establish a new connection to the server
      *
      * @exception Exception Description of Exception
      */
      protected void createConnection()
      throws Exception
      {
      boolean tracing = log.isTraceEnabled();
      if( tracing )
      log.trace("Connecting to : "+addr+":"+port);

      /** Attempt to load the socket factory and if this fails, use the
      * default socket factory impl.
      */
      SocketFactory socketFactory = null;
      if( socketFactoryName != null )
      {
      try
      {
      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      Class factoryClass = loader.loadClass(socketFactoryName);
      socketFactory = (SocketFactory) factoryClass.newInstance();
      }
      catch(Exception e)
      {
      log.debug("Failed to load socket factory: "+socketFactoryName, e);
      }
      }
      // Use the default socket factory
      if( socketFactory == null )
      {
      socketFactory = SocketFactory.getDefault();
      }

      // Look for a local address and port as properties
      String tmp = System.getProperty(LOCAL_ADDR);
      if( tmp != null )
      this.localAddr = InetAddress.getByName(tmp);
      tmp = System.getProperty(LOCAL_PORT);
      if( tmp != null )
      this.localPort = Integer.parseInt(tmp);
      if( tracing )
      {
      log.trace("Connecting with addr="+addr+", port="+port
      + ", localAddr="+localAddr+", localPort="+localPort
      + ", socketFactory="+socketFactory
      + ", enableTcpNoDelay="+enableTcpNoDelay
      );
      }

      if( localAddr != null )
      socket = socketFactory.createSocket(addr, port, localAddr, localPort);
      else
      socket = socketFactory.createSocket(addr, port);

      socket.setTcpNoDelay(enableTcpNoDelay);
      mSocket = new SocketMultiplexor(socket);
      out = new ObjectOutputStream(new BufferedOutputStream(mSocket.getOutputStream(1)));
      out.flush();
      in = new ObjectInputStream(new BufferedInputStream(mSocket.getInputStream(1)));
      }