コード例 #1
0
ファイル: Cliente.java プロジェクト: Heikoz/DSChat
  public void executa() {
    try {
      cliente = new Socket(this.host, Servidor.serverPort);
      System.out.println(
          "PortaLocal do socket: "
              + cliente.getLocalPort()
              + "\nPorta conectada: "
              + cliente.getPort()
              + "\nLocalSocketAddress: "
              + cliente.getLocalSocketAddress()
              + "\nInetAddress: "
              + cliente.getInetAddress()
              + "\nRemoteSocketAddress: "
              + cliente.getRemoteSocketAddress());
      System.out.println("Cliente conectado!");
      System.out.println("testes");

      // thread para receber mensagens do servidor
      ImpressoraCliente r = new ImpressoraCliente(cliente.getInputStream());
      new Thread(r).start();

      conectado = true;
      mainWindow.conectado(this);
      // cliente.close();

    } catch (IOException e) {
      mainWindow.getTextConsole().setText("Não foi possível se conectar ao servidor.");
      conectado = false;
      System.err.println(e.getMessage());
    }
  }
コード例 #2
0
ファイル: GameSystem.java プロジェクト: jcote008/assignment3
 public void run() {
   m_MainWindow.run();
 }