⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rmifileclient.java

📁 its is a java RMI code for file transfer, it consist of code for server and client.
💻 JAVA
字号:
import java.io.*;
import java.rmi.*;

public class RMIFileClient
{
	public static void main(String args[])
	{
	if(args.length !=2)
	{
	System.out.println("Error : You must pass the <file-name> and the <machine-address>.");
	System.exit(0);
	}

	try
	{
		String str="rmi://" + args[1] + "/FServer";
		FileRemote f=(FileRemote)Naming.lookup(str);
		byte[] data=f.loadFile(args[0]);
		File file=new File(args[0]);
		BufferedOutputStream outputFile=new
		BufferedOutputStream(new FileOutputStream(file.getName()));
		outputFile.write(data,0,data.length);
		outputFile.flush();
		outputFile.close();
		System.out.println("You specified file is doawnloaded form the server");
	}
	catch(Exception e)
	{
		System.out.println("Error : "+e);
	}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -