package test;
import java
import java
public class ClientApp
private Socket socket;
private BufferedReader netIn;
private PrintWriter netOut;
private BufferedReader keyboardIn;
xxxx
static Boolean finished = false;
public ClientApp() throws IOException
System
keyboardIn = new BufferedReader(new InputStreamReader(System
try
if (keyboardIn
socket = new Socket(InetAddress
} else
socket = new Socket(InetAddress
}
netIn = new BufferedReader(new InputStreamReader(socket
xxxx
netOut = new PrintWriter(socket
} catch (UnknownHostException e)
System
System
}
System
while (!finished)
System
netOut
netOut
String str = netIn
if (str == null)
finished = true;
xxxx
break;
}
System
if (str
finished = true;
break;
}
}
netIn
netOut
keyboardIn
socket
}
public static void main(String[] args) throws IOException
new ClientApp(); xxxx
}
}
[
From:http://tw.wingwit.com/Article/program/Java/gj/201311/27732.html