Aaaaa988

Untitled

Jul 15th, 2019
159
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ru.kiselev;
  2.  
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5. import java.io.OutputStream;
  6. import java.io.PrintWriter;
  7. import java.net.ServerSocket;
  8. import java.net.Socket;
  9. import java.util.Scanner;
  10.  
  11. public class Main {
  12.     public static void main(String[] args) {
  13.         try (ServerSocket s = new ServerSocket(1050))
  14.         {
  15.             Socket client = s.accept();
  16.             InputStream inStream = client.getInputStream();
  17.             OutputStream outStream = client.getOutputStream();
  18.             Scanner in = new Scanner(inStream);
  19.             PrintWriter out = new PrintWriter(outStream);
  20.             out.write("Hello");
  21.             out.flush();
  22.         } catch (IOException e) {
  23.             System.err.println(e.getMessage());
  24.         }
  25.     }
  26. }
RAW Paste Data