|
|
|
|||||
|
how to know which port the adapter is using?
if i create a adapter using below statement:
Ice::ObjectAdapterPtr adapter= ic->createObjectAdapterWithEndpoints("sp", "tcp"); because the port is not specified, it will be selected by the operating system. but now i want to know which port the opeating system selected for the adapter? thanks for your reply.
__________________
kin Young university: Sun Yat-sen University url: http://www.sysu.edu.cn learning ICE.
|
|
|||||
|
Is this still the most current information for this particular problem?
We have a situation where we require running more than one server on a machine, each running as different users. So a statically defined port won't work for us. Being able to figure out what port was selected automatically without having to do some crazy regex on a string would be greatly beneficial. Last edited by kundertk : 07-04-2008 at 11:48 AM. Reason: Adding more context.. |
|
||||||
|
Sorry, other than the technique recommended by Benoit (parsing strings), there is no way to retrieve this information.
An alternative to parsing the stringified form of the proxy is to call ice_getEndpoints() on the proxy, which returns a sequence of Endpoints. Then on each endpoint call toString() which, for a tcp endpoints, would return something like "tcp -h ... -p ...". This might be marginally easier to parse. Out of curiosity, why do you need this information? |
|
|||||
|
Basically, we have an application that spawns child processes, and we want the child to be able to communicate with the parent process bi-directionally via Ice. To initiate the communication the child needs to know what port to connect to on the parent. The parent port isn't known ahead of time because there could be N copies of it running on a particular host, any of them as a different user. So the parent needs to pass the port as a parameter to the child.
|
|
|||||
|
No I haven't. Now that I think of it, I think that would completely solve my problem. I'm so used to thinking in terms of hosts and ports I never even considered just passing around a stringified proxy.
Thanks for the tip! |
|
||||||
|
There are a couple of things you should keep in mind if you decide to pass a stringified proxy to a child process. First of all, the string will contain spaces, so you may need to enclose it in quotes depending on how you are spawning the child. Second, the stringified proxy itself may contain quotes if the proxy's identity name or category has spaces. Of course, you only need to worry about the second issue if it's possible for your identities to contain spaces.
Take care, Mark |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| QNX port | n2503v | Help Center | 5 | 12-18-2006 06:16 PM |
| how to bind 0.0.0.0:port ? | ewiniar | Help Center | 3 | 06-22-2006 10:15 PM |
| why not and when does ICE port to Symbian OS? | genelee | Comments | 4 | 12-08-2005 04:42 PM |
| OpenBSD Port of Ice? | msw10100 | Help Center | 0 | 07-30-2005 03:48 PM |
| AIX Port | ScottDiedrick | Help Center | 1 | 04-13-2004 05:37 PM |