This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void iniciaCliente(){ | |
try { | |
System.out.print("\nCliente tentando conectar com oservidor..."); | |
client = new Socket(enderecoDoServidor, porta); | |
System.out.print("\n Conexão estabelecida..."); | |
in = new DataInputStream((client.getInputStream())); | |
out = new DataOutputStream(client.getOutputStream()); | |
//Enviando a hora agora (T1) | |
out.writeUTF(String.valueOf(System.currentTimeMillis())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String args[]){ | |
ServerSocketThiago server; | |
server = new ServerSocketThiago(); | |
server.iniciaServidor(); | |
System.out.println("Servidor iniciado"); | |
ClientSocketThiago client; |