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();
}
}
}
恋爱进行时九游版
恋爱进行时九游版是一款以模拟恋爱玩法为核心的角色扮演手游,精
皇室对决fr(Null’s Royale)
皇室对决fr,即皇室战争的私服变态版本,在该版本中玩家能够拥
养了个猫联机版游戏
养了个猫小游戏一个猫咪主题的模拟经营类型的手游,在游戏中我那
模拟山羊收获日小米版
模拟山羊收获日小米版是一个极其魔性的手机游戏,在游戏中玩家将
女配逆袭之素衣
女配逆袭之素衣是一款恋爱养成冒险的一款游戏,可以角色扮演,在