public static void main(String[] args) { ServerSocket s = new ServerSocket(4444); while (true) { Socket ns = s.accept(); DataInputStream in = new DataInputStream(ns.getInputStream()); DataOutputStream out = new DataOutputStream(ns.getOutputStream()); while (true) { String fromClient = in.readUTF(); out.writeUTF(protocol protocol protocol.processLine(fromClient)); if (fromClient.equals(“Bye”)) break; } in.close(); out.close(); ns.close() } s.close(); }
Galera to em dúvida sobre a conexão no protocolo TCP, no código acima NS e S adotam a mesma porta ?