标签:ade col ima ESS 封装 inf style throw 通信
客户端代码:
public class ClientDemo { public static void main(String[] args) throws IOException { //创建客户端Socket对象 Socket s= new Socket("192.168.50.76",22222); //封装文本文件的数据 BufferedReader br = new BufferedReader(new FileReader("myNet\\InetAddressDemo.java")); //封装输出流写数据 BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream())); String line; while ((line=br.readLine())!=null){ bw.write(line); bw.newLine(); bw.flush(); } //释放资源 br.close(); s.close(); } }
服务器端代码:
InetAddressDemo.java内容:
运行后Copy.java中的内容:
标签:ade col ima ESS 封装 inf style throw 通信
原文地址:https://www.cnblogs.com/pxy-1999/p/12859860.html