RTC Forums
November 25, 2024, 12:03:52 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: How to listen on 3 ports with one RtcHttpServer  (Read 5738 times)
Peter M.
RTC License+
****
Posts: 30


« on: December 27, 2010, 07:19:21 PM »

I'm creating an application server.

The RtcHttpServer "ServerPort" property only allows 1 port (ex: 80), but our application needs to listen on three ports at the same time (ex: 80, 443, 8080).

Is there a way to accomplish this?

Thanks,
-Peter
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: December 27, 2010, 08:20:57 PM »

Yes, but not with a single TRtcHttpServer component. You need a separate TRtcHttpServer component for each Port you want to listen on. If you want the exact same code to run for all the ports, you will use TRtcDualDataServerLink components to connect TRtcHttpServer components together and link your TRtcDataProvider and TRtcServerModule components to the "main" TRtcDualDataServerLink component.

One TRtcDualDataServerLink component can be connected to two TRtcHttpServer components, so you will need two TRtcDualDataServerLink components. For example, you could link two TRtcHttpServer components to the 1st TRtcDualDataServerLink component, then use a 2nd TRtcDualDataServerLink component to link the 1st TRtcDualDataServerLink component and a 3rd TRtcHttpServer component together.

As you have probably guessed, instead of linking TRtcDataProvider and TRtcServerModule components to one of the TRtcHttpServer components through their "Server" property, you will connect them to the 2nd TRtcDataServerLink component through their "Link" property.

Naturally, since you will have three TRtcHttpServer components, you will need to configure and start listening on each TRtcHttpServer component separately. The up-side of using TRtcDualDataServerLink components is that you will only need a single set of TRtcDataProvider and/or TRtcServerModule components for your application, regardless of the number of Ports you want your code to be accessible from.

By the way ...

I do NOT think it is a good idea to make *everything* accessible on all three ports. For example, you will normally want to use ONLY port 334 (SSL encrypted) for user login and any other information you want to protect. It is also common practice to use port 8080 for administrative access (Server configuration), which is usually a separate part of your application with different implementation from the application your customers will use and see.

In other words, even though you COULD link all your code to all three Server listeners and make everything available through all the Ports, you will most likely want to separate your functional components (TRtcDataProvider and TRtcServerModule) into groups and connect each group  to the appropriate TRtcHttpServer or TRtcDualDataServerLink component (depending on the number of Ports you want each group to be accessible from).

Best Regards,
Danijel Tkalcec
Logged
Peter M.
RTC License+
****
Posts: 30


« Reply #2 on: December 27, 2010, 08:38:38 PM »

Thanks for the explanation -- I'll take a close look at this strategy.

BTW, regarding...
Quote
I do NOT think it is a good idea to make *everything* accessible on all three ports.

I agree with your logic for a scenario which separates Admin/Login/Normal access, but unfortunately we do need to make everything accessible on all three ports. 

Here's why:
90% of our thin-client apps are installed in retail stores who DO allow communication through port 80
... but about 5% of the stores only allow communiation through 443
... and the other 5% will only allow 8080.

(And no matter how hard we've tried to get the 443 and 8080 stores to allow port 80, they are either unwilling or the decision making process has to go through so many executive channels that it could take over a year to get a *possible* approval.)

-Peter
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: December 27, 2010, 09:41:57 PM »

I don't think you should try and force your customers who are now using Port 443 to use port 80. That would not make much sense, because moving from Port 443 to Port 80 would mean loss of the secure layer (which is only available on Port 443). On the other hand, using port 443 to access data which is normally intended for access through the standard port 80 is perfectly fine, since your customers aren't compromising anything by doing that. I think it would be a bigger problem if those using Port 80 and 8080 refuse to use Port 443 (SSL) for critical data.

Anyway ... if your customers are indifferent when it comes to security, I guess it's not your problem. The important thing is that you can do what they want. If you need an example for using TRtcDualDataServerLink components, there is one available in the RTC SDK package under "QuickStart\DualServer".

Best Regards,
Danijel Tkalcec
Logged
Peter M.
RTC License+
****
Posts: 30


« Reply #4 on: December 27, 2010, 10:06:04 PM »

The customers who want us to use 443 are not requesting it be used for reasons of security ... it just happens to be an open port on their system (their logic, not mine).

Thanks very much for the reference to "QuickStart\DualServer" ... it is a perfect example of what I am trying to do!
(I had been searching through the forum postings and Demo folders, but had not even considered the QuickStart folder.)
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.024 seconds with 17 queries.