Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Server {
- private final int port;
- private final ServerSocket serverSocket;
- private Socket clientSocket;
- private DataInputStream in;
- private Shape shape;
- private static final int COUNT_OF_ARGUMENTS =3;
- public Server(int port, Shape shape) throws IOException
- {
- this.port=port;
- this.shape=shape;
- serverSocket = new ServerSocket(port);
- }
- public void StartListening() throws IOException
- {
- double[] inputData = new double[COUNT_OF_ARGUMENTS];
- while(true!=false)
- {
- clientSocket = serverSocket.accept();
- in = new DataInputStream(clientSocket.getInputStream());
- for(int i=0;i<3;i++)
- inputData[i]=in.readDouble();
- Client client = new Client(clientSocket,inputData, shape);
- client.run();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement