4 Replies Latest reply on Dec 14, 2010 3:28 PM by Ron Sigal

    Configure Local port for client socket

    giftsamuel asir Newbie

      Hi All,

      My clients and  servers will have a firewall between them, How do  I set localports for  the client socket?  The reason if the ports are added in the firewall  exception list, I should communicate with the server with the configured  port.

       

      thanks in advance.

        • 1. Re: Configure Local port for client socket
          giftsamuel asir Newbie

          Hi All,

          I would like to set local port for the client socket. I had ponder the net to find a way to do this. I found that by using bisocket, If the client is behind the firewall and the server doest have firewall means it is working. But for me, Both the client and server is behind the firewall. Is there any way to send and receive data between the client and server which is behind the firewall. Please help me.

           

          Thanks in Advance!!

          • 2. Re: Configure Local port for client socket
            Ron Sigal Master

            Hi Giftsamuel,

             

            I'm confused by your two questions.  In the first you said "My clients and  servers will have a firewall between them" and in the second you said "Both the client and server is behind the firewall".  If there is no firewall between the client and the server, then there shouldn't be a problem.  If there is a firewall between the client and the server, and if the firewall translates the server's 'external" address to an "internal" address, then you can use the "serverBindAddress" parameter to bind the server to the "internal" address and the "clientConnectAddress" parameter to give the client the "external" address.  See Chapter 5 of the Remoting Guide (http://www.jboss.org/jbossremoting/documentation/v2.html) for more information.

             

            -Ron

            • 3. Re: Configure Local port for client socket
              giftsamuel asir Newbie

              Hi Ron,

               

              Thanks for the reply. Sorry for my confusing questions.

               

              i am newbie to jboss remoting. Let me explain my environment.

               

              I have 2 machines and both will communicate using TCP/IP with SSL Socket.
              All the ports will be blocked in the 2 machines and certain ports will be open for communication.

               

              In the machine A,

               

              Listener port = 50010

               

              out going port range = 60000 to 60010

               

              In the machine B,

               

              Listener port = 24000

               

              out going port range = 60000 to 60010

               

              The above said ports will be opened in both machines for communication.

               

              As   per my understanding jboss remoting takes the outgoing ports dynamically to connect with listener port(50010 or 24000) of other end.

               

              Is there any possibility to instruct the jboss remoting to use any of custom defined free port(from 60000 to 60010) to connect to the  listener  port(50010 or 24000) of the other end ?

              Thanks in advance!!

              • 4. Re: Configure Local port for client socket
                Ron Sigal Master

                Hi Giftsamuel,

                 

                Remoting doesn't have a built-in facility for doing what you're asking for.  However, here's something you can try.  When SSLSocketClientInvoker tries to create a new socket (actually the code is in SocketClientInvoker), it will look for a configured socket factory and, if one exists, it will call

                 

                  s = socketFactory.createSocket();

                 

                You could create a custom socket factory that binds a new socket to a port in the appropriate range.

                 

                For more information about configuring socket factories, see Section "5.7. Socket factories and server  socket factories" of the Remoting Guide (http://docs.jboss.org/jbossremoting/2.5.3.SP1/html/).

                 

                -Ron