Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.zack6849.nope;
- import java.io.IOException;
- import java.io.PrintStream;
- import java.net.Socket;
- import java.util.Scanner;
- class main{
- public static void main(String args[]){
- try {
- Socket s = new Socket("localhost",12345);
- Scanner in = new Scanner(System.in);
- System.out.println(s.getLocalSocketAddress());
- s.setKeepAlive(true);
- PrintStream ps;
- ps = new PrintStream(s.getOutputStream());
- ps.println("Incoming connection from ");
- System.out.println(s.getLocalAddress());
- while(true){
- ps.println(in.nextLine());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
Add Comment
Please, Sign In to add comment