Guest User

Untitled

a guest
Jan 18th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. package me.zack6849.nope;
  2.  
  3. import java.io.IOException;
  4. import java.io.PrintStream;
  5. import java.net.Socket;
  6. import java.util.Scanner;
  7.  
  8. class main{
  9. public static void main(String args[]){
  10. try {
  11. Socket s = new Socket("localhost",12345);
  12. Scanner in = new Scanner(System.in);
  13. System.out.println(s.getLocalSocketAddress());
  14. s.setKeepAlive(true);
  15. PrintStream ps;
  16. ps = new PrintStream(s.getOutputStream());
  17. ps.println("Incoming connection from ");
  18. System.out.println(s.getLocalAddress());
  19. while(true){
  20. ps.println(in.nextLine());
  21. }
  22. } catch (Exception e) {
  23. e.printStackTrace();
  24. }
  25. }
  26. }
Add Comment
Please, Sign In to add comment