class test{ public test() {
}
public static void main(String[] args) throws IOException {
SAXBuilder sb = new SAXBuilder();
//从文件构造一个Document,因为XML文件中已经指定了编码,所以这里不必了
Document doc = sb.build(new FileInputStream("exampleA.xml"));
InetAddress addr = InetAddress.getByName("201.121.104.5");
Socket socket=new Socket(addr,2012);
try{
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);
String s = "<a><b>test1</b></a>";
out.print(s);
out.print("\3");
out.flush();
}finally{
socket.close();
}
}
}
}
public static void main(String[] args) throws IOException {
SAXBuilder sb = new SAXBuilder();
//从文件构造一个Document,因为XML文件中已经指定了编码,所以这里不必了
Document doc = sb.build(new FileInputStream("exampleA.xml"));
InetAddress addr = InetAddress.getByName("201.121.104.5");
Socket socket=new Socket(addr,2012);
try{
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);
String s = "<a><b>test1</b></a>";
out.print(s);
out.print("\3");
out.flush();
}finally{
socket.close();
}
}
}
.Protocol = sckTCPProtocol
.RemoteHost = "201.121.104.5"
.RemotePort = "2012"
.Connect
End With