5 Replies Latest reply on Feb 21, 2012 9:42 PM by EJP

    I got a problem connecting server using two systems

      Hi peoples,
      I got a problem while connecting server and client using two independent systems.The same program is working in same machine as a server and client.i here mention the programs.
      im using netbeans

      **Client program:**

      String address=jTextField1.getText().trim(); //got ip address of server from textfield
      Socket client;

      try {
      InetAddress adressen = InetAddress.getByName(address);
      client = new Socket(adressen, 4444);
      BufferedReader scanf = new BufferedReader(new InputStreamReader(client.getInputStream()));
      String someString = scanf.readLine();
      System.out.println("From Server: " + someString);
      jLabel2.setText("From Server :"+someString);
      } catch (Exception e) {

      SErver PRogram:
      try {
      ServerSocket listener = new ServerSocket(4444);
      while (!finished) {
      Socket to_client = listener.accept();
      String address=InetAddress.getLocalHost().getHostAddress();

      OutputStream out = to_client.getOutputStream();
      PrintWriter pout = new PrintWriter(out, true);
      pout.println("Hello! this is server talking to you.");
      }// end of try
      catch (Exception ie) {

      Help me people to find out the solutions
      Note Guys Program working in same machine as server and client but not working in two independent machine as client and server

      mail me also <email address removed by moderator>

      Edited by: rukbat on Feb 11, 2012 1:23 PM
      Your email address has been removed.
      Requests for communication beyond the forums defeats the whole reason for having forums (you would be hiding possible solutions from everyone else).

      Additionally, showing your email address in a world-readable public forum invites harvesters to spam you for all eternity.