Skip to content

Instantly share code, notes, and snippets.

@revox
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save revox/9b122aa9ac5fc6df8f7e to your computer and use it in GitHub Desktop.

Select an option

Save revox/9b122aa9ac5fc6df8f7e to your computer and use it in GitHub Desktop.
import java.io.*;
import java.net.*;
class evenSimplerEchoServer
{
public static void main(String[] argv) throws Exception
{
ServerSocket s = new ServerSocket(5000);
Socket t = s.accept();//wait for client to connect
InputStream b = t.getInputStream();
OutputStream p = t.getOutputStream();
int c;
while((c=b.read())!=-1) {
p.write(c);
p.flush();
System.out.print((char) c);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment