4 Replies Latest reply on Jul 8, 2008 6:06 PM by DrClap

    Server socket deployment

    843785
      Hi,

      I finished building a server client application and now i want to deploy my server on the web.
      The server and client open a socket as follow:


      //Client:
      StreamConnection socket;
      socket = (StreamConnection)Connector.open("socket://localhost:4444");


      //Server
      static void runServer() {
      ServerSocket serverSocket= null;
      try {
      serverSocket= new ServerSocket(4444);

      while (true)
      new BeelBeeClientConnection( serverSocket.accept()).start();

      } catch (IOException ioe){
      System.err.println(ioe.toString());
      }
      }


      My question is, What do i need to do in order to make the server accessible from any computer with an internet connection?

      Many thanks
        • 1. Re: Server socket deployment
          843785
          My question is, What do i need to do in order to make the server accessible from any computer with an internet connection?
          :O w00t? How about running the server on a computer with internet access? **Note** Not having it behind an router might ease things up as well.
          Also, am I missing something really obvious, or are you implying that other computers shouldnt be able to access the server over the internet without complications when you open up an ServerSocket?
          • 2. Re: Server socket deployment
            843785
            My server is behind a router.
            I understand that you suggest to replace "localhost" with the IP address. But with which one? With the External ip? Didn't work for me... And i didn't even try the internal IP address...

            If my server wasn't behind a router nor a firewall - would changing localhost to the IP address would do?

            Thanks
            • 3. Re: Server socket deployment
              843785
              If my server wasn't behind a router nor a firewall - would changing localhost to the IP address would do?
              As I never used StreamConnection before(cause it aint in the standard api etc.) I cant say for sertain. But if you use an Socket("IP", port), then I would say yes.
              • 4. Re: Server socket deployment
                DrClap
                hayona wrote:
                My server is behind a router.
                Then you need to configure your router to forward all incoming traffic to port X (whatever port you chose for your server to listen on) to your server at that same port. You don't do any special programming in your server program at all.