예제 #1
0
 public static void main(String[] arg) {
   int serverPort = 10000 + 128 * 20 + 1;
   InetAddress serverAddr = null;
   int listnPort;
   if (arg[0] != null) listnPort = Integer.valueOf(arg[0]);
   else listnPort = 88;
   try {
     serverAddr = InetAddress.getByName("localhost");
   } catch (UnknownHostException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   WorkerClient client = new WorkerClient(serverPort, serverAddr, listnPort);
   client.start();
 }
예제 #2
0
 public void run() {
   switch (msg.command) {
     case CMessage.ACK_JOIN:
       client.setid(msg.client_id);
       break;
     case CMessage.JOB:
       client.setid(msg.client_id);
       client.sendAck(msg.start);
       client.breakHash(msg.start, msg.end, msg.hash);
       break;
     case CMessage.CANCEL_JOB:
       client.cancel();
       break;
     case CMessage.PING:
       client.reply();
       break;
     default:
       break;
   }
 }