Commit dc2418fa authored by Stephen's avatar Stephen
Browse files

Fixed Server

parent 51d3fd1a
......@@ -278,6 +278,7 @@ public class TCPServer implements Runnable {
}
public static void main(String[] args) throws Exception {
int port = 6789;
TCPServer server = new TCPServer(port);
......@@ -285,12 +286,11 @@ public class TCPServer implements Runnable {
Thread trackerListener =new Thread(server);
trackerListener.start();
System.out.println("Waiting for client to connect..");
server.clientSocket = server.serverClientSocket.accept();
System.out.println("User connected to " + server.serverClientSocket.getLocalSocketAddress() + ", " + server.clientSocket.getLocalSocketAddress());
while(true)
{
System.out.println("Waiting for client to connect..");
server.clientSocket = server.serverClientSocket.accept();
// Membaca request dari client
BufferedReader inFromClient =new BufferedReader(new InputStreamReader(server.clientSocket.getInputStream()));
DataOutputStream outToClient = new DataOutputStream(server.clientSocket.getOutputStream());
......
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