Multiple protocols and ports

What would be the best approach to allow connections to the same service via different protocols and ports.

For example I want different RO clients to be able to connect to the same server/service via http on one port, https on another and via tcp (SuperTcp) on a third.

Do I run multiple ApplicationServers in the same program, or is there a way to bind multiple protocols/ports to a single server? Or is there some other way?

Thanks

Hi,
Can you specify your platform (Delphi or .NET) ?

.NET

A code-first solution would be ideal.

Thanks

Hello

A Remoting SDK server app can use several ServerChannel instances to expose more than one protocol (mean, Http, Tcp etc).

ApplicationServer infrastructure assumes that all remote access components are defined in a NetworkServer instance. Luckily this infrastructure also provides a very simple way to extend/replace the default NetworkServer implementation:

Add a new code file to the server app project and put there this class:

[ServerInfrastructure]
public class ExtendedNetworkServer : NetworkServer
{
   private IpHttpServerChannel _serverChannel;

   protected override void InternalStart()
   {
       base.InternalStart();

       this._serverChannel = new IpHttpServerChannel();
       this._serverChannel.Port = this.Port + 1;
this._serverChannel.Dispatchers.AddRange(this.ServerMessages.Select(m =>
           new MessageDispatcher(m.DefaultDispatcherName, m)));
       this._serverChannel.Open();
   }

   protected override void InternalStop()
   {
       this._serverChannel.Close();
       base.InternalStop();
   }
}

In the sample above an additional server channel listening on a different port is added to the network server. The ServerInfrastructure attribute applied to this class ensures that it will be used to manage network connectivity instead of the default NetworkServer implementation.

You can find more about the ApplicationServer class in this page: https://docs.remotingsdk.com/Servers/Concepts/ApplicationServerClassNet/

Here is a sample app: ROServer_17657.zip (59.5 KB)
It can be accessed bot visa https on port 8099 and via http on port 8100

Regards

Thanks antonk,

That’s exactly what I needed. Perfect!

One curiosity though. I tried to get the second channel/port to run SSL too by adding

this._serverChannel.SslOptions.UseTls = this.UseTLS;
this._serverChannel.SslOptions.CertificateFileName = this.CertificateFileName;

to the ExtendedNetworkServer.InternalStart() method, but that didn’t seem to make a difference. Am I missing something or is it just not possible to approach it this way. Not a big deal at this point, as I don’t foresee needing to do this, but was curious why it wasn’t working.

Thanks

You need to use

this._serverChannel.SslOptions.Enabled = this.UseTLS;

PS For sure the property serverChannel.SslOptions.UseTls name here is really confusing. This property enables the TLS 1.2 protocol where supported (or a older one TLS 1.1) (otherwise legacy SSL 3.0 + TLS 1.1 combination is used).

Spot on, once again!

Works perfectly.

Many thanks.