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?
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:
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.
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.
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).