`
Poechant
  • 浏览: 212930 次
博客专栏
Bebe66e7-3a30-3fc9-aeea-cfa3b474b591
Nginx高性能Web服务...
浏览量:23533
5738817b-23a1-3a32-86de-632d7da73b1e
Cumulus实时媒体服务...
浏览量:21436
社区版块
存档分类
最新评论

Java API——RMIIO入门教程(3)远程流传输示例之RMIIO服务器端源码

 
阅读更多

RMI Server端。这个其实跟RMIIO关系不大。


package com.sinosuperman.rmiio2;

import java.net.MalformedURLException;
import java.rmi.AlreadyBoundException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;


public class RmiioServer2 {
	
	public static void main(String[] args) {
		
		try {
			/* Create a Remote object. */
			RmiioService2 testRMIIO = new RmiioServiceImpl2();
			
			/* Create a registry object with 1235 port. */
			LocateRegistry.createRegistry(2234);
			
			/* Register the Remote object to RMI registry server, and name it as testrmi. */
			Naming.bind("rmi://localhost:2234/testrmiio", testRMIIO);
			
			System.out.println("注册远程对象成功");
			
		} catch (RemoteException e) {
			System.out.println("远程对象创建异常");
			e.printStackTrace();
		} catch (MalformedURLException e) {
			System.out.println("URL畸形异常");
			e.printStackTrace();
		} catch (AlreadyBoundException e) {
			System.out.println("重复绑定异常");
			e.printStackTrace();
		}
	}
}


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics