Java ServerSocket Example..

..and connecting to it with Telnet!

MyServer.java
/* User: koray@tugay.biz Date: 21/02/15 Time: 13:30 */
 
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
 
public class MyServer {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(8888);
        Socket accept = serverSocket.accept();
        System.out.println("Accepted..");
        InputStream inputStream = accept.getInputStream();
        while(true){
            int read = inputStream.read();
            System.out.print((char) read);
        }
    }
}

In Action: