问题
I am developing a peer to peer file sharing application usig Java and CORBA. I am new to CORBA.
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 :
- filename
- Share(Basically, it stores the option of sharing or not sharing the file in the network)
- HostName
- PortNumber
I am stuck at this point:
- How do I find the hostname and portnumber of a client when registering the files to SQL?. Because I believe with the hostname and portnumber, I will be able to build a socket connection between two client programs and therefore start sharing file between peers.
回答1:
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.
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.
来源:https://stackoverflow.com/questions/25475644/identify-client-in-peer-to-peer-filesharing-using-java-and-corba-and-build-sock