问题描述
我正在开发对等文件共享应用程序usig Java和CORBA.我是CORBA的新手.
I am developing a peer to peer file sharing application usig Java and CORBA. I am new to CORBA.
到目前为止,我已经成功创建了一个客户端程序,该程序通过CORBA在SQL数据库中注册了一个文件.该表存储以下信息:
So far I have successfully created a client program that registers a file in the SQL Database via CORBA. The table stores the following information :
- 文件名
- 共享(基本上,它存储网络中共享文件或不共享文件的选项)
- 主机名
- 端口号
我现在被困住了:
- 在将文件注册到SQL时如何找到客户端的主机名和端口号?因为我相信使用主机名和端口号,所以我将能够在两个客户端程序之间建立套接字连接,从而开始在同级之间共享文件.
推荐答案
目前,尚无标准化的方法来检索CORBA客户端的主机名/端口号,原因是CORBA并不仅仅局限于套接字,可能多种传输方式,其寻址方式完全不同.某些ORB确实进行了扩展以使其成为可能,例如TAO具有TransportCurrent功能,该功能在客户端与IIOP连接时立即提供对此类信息的访问. JacORB确实支持org.jacorb.transport.iiop.Current,看起来也很相似.
There is at this moment no standardized way to retrieve hostname/portnumber of a CORBA client, the reason is that CORBA is not tied to just sockets, there could be multiple kinds of transports which have completely different ways for addressing. Some ORBs do have some extension to make this possible, for example TAO has a TransportCurrent feature that does give access to this kind of information at the moment the client connects with IIOP. JacORB does have support for org.jacorb.transport.iiop.Current which also looks similar, have a look at that.
但是为什么不使用CORBA进行文件传输呢?比起您不必获取此信息,您只需存储字符串化的对象引用并在以后使用它即可.
But why not use CORBA for the file transfer? Than you don't have to get this information but just can store the stringified object reference and use it at a later moment.
这篇关于使用Java和Corba识别对等文件共享中的客户端.并在2个客户端之间建立套接字套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!