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/21b37f7895f9f098deaa to your computer and use it in GitHub Desktop.

Select an option

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