java Socket使用注意
Socket s = new Socket(ia, port);
BufferedOutputStream bufOut = new BufferedOutputStream(s.getOutputStream());
byte[] bytes = logXml.getBytes(CHARSET);
bufOut.write(bytes);
// 因为下边还要使用getInputStream,所以此处不可以使用bufOut.close()
bufOut.flush(); //此处必须flush
s.shutdownOutput();
BufferedReader bufin = new BufferedReader(new InputStreamReader(s.getInputStream(), CHARSET));
String line = null;
while (null != (line = bufin.readLine()))
{
System.out.println(line);
}