import java.io.*;importjava.net.Socket;importjava.util.regex.Pattern;public classTestSocket {public static voidmain(String[] args) {/** command:
* on1 off1 read1
* on2 off2 read2
**/
try{
BufferedReader input= new BufferedReader(newInputStreamReader(System.in));boolean flag = true;while(flag) {
System.out.println("输入信息: ");
String str=input.readLine();if ("bye".equals(str)) {
flag= false;
}else{
String s=sendCommand(str);
System.out.println(s);
}
}
input.close();
System.err.println("good bye");
}catch(Exception e) {
e.printStackTrace();
}
}public staticString sendCommand(String command) {
String result;
String ip= "172.18.20.188";int port = 5000;