Socket soc=null;
InputStream in=null;
OutputStream out=null;
soc=new Socket(host,port);
in=soc.getInputStream();
out=soc.getOutputStream();
String length=String.format("%04d",data.length());
System.out.println("发送的数据长度为"+length);
out.write(length.getBytes());
out.write(data.getBytes());
out.flush();
这个是我通过短连接的方式向服务器发送的数据,怎样接收服务器返回的数据,求各位大神补充一下,之前没写过这种连接方式的代码。