Removing Endpoint from the server.

RCF support and general discussion.
Post Reply
okg
Posts: 10
Joined: Mon May 27, 2013 2:14 pm

Removing Endpoint from the server.

Post by okg »

Hi,

I’m trying to connect a Merto/Windows8 tile/WindowsStore client application with locally installed RCF server. The problem is Metro applications are generally not allowed to communicate via localhost. There is no sense to discuss “why so”. It’s just one of the Microsoft limitations. So, I’m trying to establish the local communication via a regular (not loopback) network interface. Typically any computer has a network connection, so a non-loopback interface should be available always.
So the server should listen (has a TCP style endpoint) on a (say so) 192.168.1.x.
The problem is that the 192.168.1.x is potentially mutable. The computer can be later connected to a different router/network or so. Anyway I can’t rely on DHCP lease always.
As the result I have to call server->addEndpoint() everytime the IP is changed.
Obviously there is a wish to remove the previous (useless hereafter) endpoint.
How could I do that?
Or, taking into account the IP changes should not be often, I could just accumulate the endpoints and there should be no any significant resource leakage?
I could try to call removeservice (after making it public), but how I could identify which service to remove. I have to have some other static RCF endppoints/listeners beyond the mutable 192.168.1.x

Thank you

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: Removing Endpoint from the server.

Post by jarl »

That's a somewhat unusual situation to be in. RCF currently has limited support for removing endpoints (RcfServer::removeServerTransport()) , but I've never come across a situation where it's needed.

Some options:
1) Can you listen on 0.0.0.0 instead?
2) Can you use a named pipe for your server?
3) Can you stop and delete your RcfServer when there is a network change, and then create and start a new one?

If you do need to call RcfServer::removeServerTransport(), you'll need to capture the return value from addEndpoint(), convert it to a shared_ptr, and then later on pass it to removeServerTransport(). The RcfServer will need to be stopped when you do this.

If you only have one transport in your RcfServer, there is also RcfServer::getServerTransportPtr() which will return the shared_ptr you need to pass to removeServerTransport().

Hope that helps.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

okg
Posts: 10
Joined: Mon May 27, 2013 2:14 pm

Re: Removing Endpoint from the server.

Post by okg »

Thank you very much for the swift reply Jarl,

The Metro “life” brings a lot of surprises every day.

>1) Can you listen on 0.0.0.0 instead?

Would be too insecure. If so, the server will be connectable worldwide.
I would have to play with SSL on the both sides. Maybe I will have to go that way finally.

>2) Can you use a named pipe for your server?

Prohibited for Metro applications.
The worst news of today is communicating via 192.168.1.x is not allowed in full as well.

>3) Can you stop and delete your RcfServer when there is a network change, and then create and start a new one?

It would cause interruption in servicing. However, it’s the simplest way to try however.
Thank you! The most helpful ideas are typically simple but may be not visible from scratch unfortunately.
Anyway (as you said) the server must be stopped if I call removeServerTransport.

Thanks once more

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: Removing Endpoint from the server.

Post by jarl »

No worries - hope you can get it all sorted. We don't have much experience with Metro yet. It does seem like a rather different platform, compared to regular old Windows. :)
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

Post Reply