public class MySever {
public static void main(String[] args) throws Exception {
/*
* 自定义服务器。
*/
ServerSocket ss = new ServerSocket(10000);
while (true) {
System.out.println("开启服务器……");
Socket s = ss.accept();
System.out.println(s.getInetAddress().getHostAddress() + ".....connected");
FileInputStream fr = new FileInputStream("E:\\HTML\\Test.htm");
int num = fr.available();
byte[] bt = new byte[num];
fr.read(bt);
String str = new String(bt, "UTF-8");
System.out.println(str);
PrintWriter out = new PrintWriter(s.getOutputStream(),true);
out.println(str);