Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package labSK;
- import java.io.DataInputStream;
- import java.io.DataOutputStream;
- import java.io.IOException;
- import java.net.Socket;
- public class Klient {
- public static final String HOST = "127.0.0.1";
- public static final int PORT = 2020;
- public static void main(String[] args) {
- try {
- System.out.println("Устанавливаем соединение с "+HOST+" по порту " + PORT);
- Socket socket = new Socket(HOST, PORT);
- System.out.println("Соединение установлено");
- DataInputStream input = new DataInputStream(socket.getInputStream());
- DataOutputStream output = new DataOutputStream(socket.getOutputStream());
- int start = input.readInt();
- int stop = input.readInt();
- System.out.println(start + "/" + stop);
- for (int startA = start; startA <= stop; startA++) {
- if (startA % 11 == 0 && startA % 13 == 0 && startA % 17 == 0 && startA % 19 == 0) {
- output.writeInt(startA);
- }
- }
- output.writeInt(-127);
- System.out.println("Закрываем сокет");
- socket.close();
- output.close();
- input.close();
- } catch (IOException e) {e.printStackTrace();}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement