public static void main(String[] args) {
		Integer min = 10000;
		Integer max = 100000;
		int socketNum = 5;
		int temp = 0;
		long startTime = 0;

		try {
			System.out.println("Server running...");
			ServerSocket ss = new ServerSocket(9999);
			for (int i = 0; i < socketNum; i++) {
				Socket sm = new Socket("localhost", Integer.parseInt(JOptionPane.showInputDialog("port number: ")));
				ObjectOutputStream oos = new ObjectOutputStream(sm.getOutputStream());
				startTime = System.currentTimeMillis();
				//STRIPING
				oos.writeObject(min);
				oos.writeObject(max);
				oos.writeObject(socketNum);
				oos.writeObject(new Integer(i));
				
				//BLOCKING
//				temp = (max - min) / socketNum;
//				if(i == 0){
//					oos.writeObject(min);
//					oos.writeObject(min + temp);
//				} else {
//					oos.writeObject(min + temp * i + 1);
//					oos.writeObject(min + temp * (i+1));
//				}
				
				sm.close();
			}
			Integer count = 0;
			for (int j = 0; j < socketNum; j++) {
				Socket s = ss.accept();

				ObjectInputStream ois = new ObjectInputStream(s.getInputStream());

				count = count + (Integer) ois.readObject();
				System.out.println(System.currentTimeMillis() - startTime);
				System.out.println(count);

				s.close();
			}

			ss.close();
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}