public class TranFileServer {
public static void main(String[] args){
ServerSocket server;
Socket st;
try {
server = new ServerSocket(4000);
st = server.accept();
File receivedfile = new File( "src/2.rar ");
BufferedInputStream bin = new BufferedInputStream(st.getInputStream());
FileOutputStream fout = new FileOutputStream(receivedfile);
int i = bin.read();
while(i != -1){
fout.write(i);
i = bin.read();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
客户端:
public class TranFileClient {
public static void main(String[] args){
try {
Socket st = new Socket( "localhost ",4000);
File f = new File( "2.rar ");
FileInputStream fin = new FileInputStream(f);
BufferedOutputStream bout = new BufferedOutputStream(st.getOutputStream());
int size = fin.available();
for(int i = 0;i < size; i++){
bout.write(fin.read());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
迷你世界越南服 安卓版v1.7.15
迷你世界越南服是一款精美的3D沙盒游戏,拥有极高的创作自由度
糖饼外传内置菜单 安卓版v1.0.87
糖饼外传内置菜单是一款非常好玩的模拟经营类手游,玩家在游戏中
我的世界化学交换空岛整合包 最新版v1.0
我的世界化学交换空岛整合包是一款像素风格的沙盒生存游戏,游戏
创造厨房免广告版 v1.0.10
创造厨房无广告版是一款像素风模拟经营类手游,玩家们将在这里化
SimCity BuildIt无限金币版 安卓修改版v1.60.1.133743
SimCity BuildIt无限金币版是经过破解的版本,在