TCP并发上传——java源码

时间:2017-10-31 09:58:53
【文件属性】:
文件名称:TCP并发上传——java源码
文件大小:3KB
文件格式:ZIP
更新时间:2017-10-31 09:58:53
TCP 并发 上传 java 源码 import java.io.*; import java.net.InetAddress; import java.net.UnknownHostException; public class ClientDemo { public static void main(String[] args) { try { InputStream in = new FileInputStream("D:\\Client"); byte[] buf = new byte[1024*1024]; int len; ByteArrayOutputStream bufOut = new ByteArrayOutputStream(); while (true) { len = in.read(buf); if (len == -1) { new TCPClient(bufOut.toByteArray(), InetAddress.getLocalHost(), 1211); break; } else { bufOut.write(buf, 0, len); } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
【文件预览】:
TCPClient.java
2.bat
ServersDemo.java
ClientDemo.java
TCPServers.java
1.bat
编译.bat

网友评论