Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
454 B
0
Indexable
Never
import java.io.*;
import java.net.*;

public class MyServer {

public static void main(String[] args){

	try{
		ServerSocket ss = new ServerSocket(6666);
		
		Socket s=ss.accept(); //establishes connection 

		DataInputStream dis = new DataInputStream(s.getInputStream());

		String	str=(String)dis.readUTF();
		
		System.out.println("Message: "+str);

		ss.close();
	}
	
	catch(Exception e)
	{
		System.out.println(e);
	}
  }
}