/// <summary> /// Add a non-secure port on which server should listen. /// Only call this before Start(). /// </summary> public int AddListeningPort(string addr) { lock (myLock) { Preconditions.CheckState(!startRequested); return(handle.AddListeningPort(addr)); } }
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)); } } }