Skip to content
Snippets Groups Projects
Commit fa430fde authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

Merge pull request #6809 from jtattermusch/csharp_channel_server_constructors

Add more Channel and Server constructor overloads
parents d941fd87 8d829d0d
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,17 @@ namespace Grpc.Core
bool shutdownRequested;
/// <summary>
/// Creates a channel that connects to a specific host.
/// Port will default to 80 for an unsecure channel and to 443 for a secure channel.
/// </summary>
/// <param name="target">Target of the channel.</param>
/// <param name="credentials">Credentials to secure the channel.</param>
public Channel(string target, ChannelCredentials credentials) :
this(target, credentials, null)
{
}
/// <summary>
/// Creates a channel that connects to a specific host.
/// Port will default to 80 for an unsecure channel and to 443 for a secure channel.
......@@ -68,7 +79,7 @@ namespace Grpc.Core
/// <param name="target">Target of the channel.</param>
/// <param name="credentials">Credentials to secure the channel.</param>
/// <param name="options">Channel options.</param>
public Channel(string target, ChannelCredentials credentials, IEnumerable<ChannelOption> options = null)
public Channel(string target, ChannelCredentials credentials, IEnumerable<ChannelOption> options)
{
this.target = GrpcPreconditions.CheckNotNull(target, "target");
this.options = CreateOptionsDictionary(options);
......@@ -91,6 +102,17 @@ namespace Grpc.Core
GrpcEnvironment.RegisterChannel(this);
}
/// <summary>
/// Creates a channel that connects to a specific host and port.
/// </summary>
/// <param name="host">The name or IP address of the host.</param>
/// <param name="port">The port.</param>
/// <param name="credentials">Credentials to secure the channel.</param>
public Channel(string host, int port, ChannelCredentials credentials) :
this(host, port, credentials, null)
{
}
/// <summary>
/// Creates a channel that connects to a specific host and port.
/// </summary>
......@@ -98,7 +120,7 @@ namespace Grpc.Core
/// <param name="port">The port.</param>
/// <param name="credentials">Credentials to secure the channel.</param>
/// <param name="options">Channel options.</param>
public Channel(string host, int port, ChannelCredentials credentials, IEnumerable<ChannelOption> options = null) :
public Channel(string host, int port, ChannelCredentials credentials, IEnumerable<ChannelOption> options) :
this(string.Format("{0}:{1}", host, port), credentials, options)
{
}
......
......@@ -67,11 +67,19 @@ namespace Grpc.Core
bool startRequested;
volatile bool shutdownRequested;
/// <summary>
/// Creates a new server.
/// </summary>
public Server() : this(null)
{
}
/// <summary>
/// Create a new server.
/// Creates a new server.
/// </summary>
/// <param name="options">Channel options.</param>
public Server(IEnumerable<ChannelOption> options = null)
public Server(IEnumerable<ChannelOption> options)
{
this.serviceDefinitions = new ServiceDefinitionCollection(this);
this.ports = new ServerPortCollection(this);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment