Ejemplo n.º 1
0
 // only call before Start()
 public int AddPort(string addr, ServerCredentials credentials)
 {
     using (var nativeCredentials = credentials.ToNativeCredentials())
     {
         return handle.AddPort(addr, nativeCredentials);
     }
 }
Ejemplo n.º 2
0
Archivo: Server.cs Proyecto: wfarr/grpc
 // only call before Start()
 public int AddListeningPort(string addr, ServerCredentials credentials)
 {
     using (var nativeCredentials = credentials.ToNativeCredentials())
     {
         return(handle.AddListeningPort(addr, nativeCredentials));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Add a secure port on which server should listen.
 /// Only call this before Start().
 /// </summary>
 public int AddListeningPort(string addr, ServerCredentials credentials)
 {
     lock (myLock)
     {
         Preconditions.CheckState(!startRequested);
         using (var nativeCredentials = credentials.ToNativeCredentials())
         {
             return(handle.AddListeningPort(addr, nativeCredentials));
         }
     }
 }
Ejemplo n.º 4
0
 private int AddListeningPortInternal(string host, int port, ServerCredentials credentials)
 {
     lock (myLock)
     {
         Preconditions.CheckState(!startRequested);
         var address = string.Format("{0}:{1}", host, port);
         if (credentials != null)
         {
             using (var nativeCredentials = credentials.ToNativeCredentials())
             {
                 return(handle.AddListeningPort(address, nativeCredentials));
             }
         }
         else
         {
             return(handle.AddListeningPort(address));
         }
     }
 }
Ejemplo n.º 5
0
 private int AddListeningPortInternal(string host, int port, ServerCredentials credentials)
 {
     lock (myLock)
     {
         Preconditions.CheckState(!startRequested);    
         var address = string.Format("{0}:{1}", host, port);
         if (credentials != null)
         {
             using (var nativeCredentials = credentials.ToNativeCredentials())
             {
                 return handle.AddListeningPort(address, nativeCredentials);
             }
         }
         else
         {
             return handle.AddListeningPort(address);    
         }
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Add a port on which server should listen.
 /// Only call this before Start().
 /// </summary>
 /// <returns>The port on which server will be listening.</returns>
 /// <param name="host">the host</param>
 /// <param name="port">the port. If zero, an unused port is chosen automatically.</param>
 public int AddPort(string host, int port, ServerCredentials credentials)
 {
     lock (myLock)
     {
         Preconditions.CheckNotNull(credentials);
         Preconditions.CheckState(!startRequested);
         var address = string.Format("{0}:{1}", host, port);
         using (var nativeCredentials = credentials.ToNativeCredentials())
         {
             if (nativeCredentials != null)
             {
                 return handle.AddSecurePort(address, nativeCredentials);
             }
             else
             {
                 return handle.AddInsecurePort(address);
             }
         }
     }
 }