Skip to content

Instantly share code, notes, and snippets.

@AlexBHarley
Created May 27, 2016 07:54
Show Gist options
  • Save AlexBHarley/43ebc9fccee9590a8b0410b884c88575 to your computer and use it in GitHub Desktop.
Save AlexBHarley/43ebc9fccee9590a8b0410b884c88575 to your computer and use it in GitHub Desktop.
public class test {
public static void main(String[] args) throws Exception {
Socket s = new Socket();
s.connect(new InetSocketAddress("localhost", 6021));
s.setSoTimeout(100);
DataInputStream in;
DataOutputStream out;
in = new DataInputStream(s.getInputStream());
out = new DataOutputStream(s.getOutputStream());
while (true) {
try {
String a = in.readUTF();
System.out.println(a);
} catch (SocketTimeoutException e) {}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment