Commit c8107b45 authored by adwisatya's avatar adwisatya
Browse files

Server OK. TInggal map

parent e8f86b1f
...@@ -75,12 +75,13 @@ public class Client extends Thread{ ...@@ -75,12 +75,13 @@ public class Client extends Thread{
connectionSocket.close(); connectionSocket.close();
} catch (IOException ex) { } catch (IOException ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
ex.printStackTrace();
} }
System.out.println(e);
} catch (NoSuchAlgorithmException ex) { } catch (NoSuchAlgorithmException ex) {
try { try {
connectionSocket.close(); connectionSocket.close();
} catch (IOException ex1) { } catch (IOException ex1) {
ex1.printStackTrace();
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex1); Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex1);
} }
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
......
...@@ -38,14 +38,19 @@ public class TCPServer { ...@@ -38,14 +38,19 @@ public class TCPServer {
// } // }
// } // }
ServerSocket mainSocket ; ServerSocket mainSocket ;
Socket clientSocket = null;
mainSocket = new ServerSocket(portNumber); mainSocket = new ServerSocket(portNumber);
System.out.println("Start listening..."); System.out.println("Start listening...");
while(true){ while(true){
Socket clientSocket = null;
clientSocket = mainSocket.accept(); clientSocket = mainSocket.accept();
new Thread(new Client(clientSocket)).start(); try{
new Thread(new Client(clientSocket)).start();
}catch(SocketException e){
e.printStackTrace();
}
} }
} }
public static void cmdJoin() throws IOException, JSONException{ public static void cmdJoin() throws IOException, JSONException{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment