public static bool Logon(ConnectorOptions connectorOptions) { if (_connector != null && _connector.Connected) { return(true); } string userName = $@"{Environment.UserDomainName}\{Environment.UserName}"; bool isPrompt = false; var sInfo = CredentialManager.ReadCredential(_appName); bool forcePassword = connectorOptions.ForcePassword || sInfo == null || sInfo.Password.IsEmpty() || !connectorOptions.SavePassword; string password; if (forcePassword) { password = connectorOptions.SecureRequest(userName); if (password.IsEmpty()) { return(false); } isPrompt = true; } else { password = sInfo.Password; } _connector = TCPConnector.Create(connectorOptions); _connector.Connect(userName, password); if (isPrompt && connectorOptions.SavePassword) { CredentialManager.WriteCredential(_appName, userName, password); } return(true); }
public static bool Connect(EndPoint endpoint, Variant parameters) { var chain = ProtocolFactoryManager.ResolveProtocolChain(Defines.CONF_PROTOCOL_OUTBOUND_RTMP); TCPConnector <OutboundRTMPProtocol> .Connect(endpoint, chain, parameters); return(true); }
public void Connect(string host, int port, IProtocolResolver protocolResolver) { mNetworkManager.SettingConnector(host, port, protocolResolver); TCPConnector connector = new TCPConnector(); connector.connectHandler = mNetworkManager.OnConnnectComplete; connector.failHandler = mNetworkManager.OnConnectFail; connector.Connect(host, port, protocolResolver); }
public bool ConnectOutboundCluster() { var uri = new Uri(Configuration["master"]); //string localStreamName = streamConfig["localStreamName"] ?? "stream_" + Utils.GenerateRandomString(8); var parameters = Variant.Get(); //parameters["customParameters", "externalStreamConfig"] = streamConfig; parameters[Defines.CONF_APPLICATION_NAME] = Application.Name; var scheme = uri.Scheme; var endpoint = new IPEndPoint( Dns.GetHostAddresses(uri.Host).First(x => x.AddressFamily == AddressFamily.InterNetwork), uri.Port > 0 ? uri.Port : 1935); var chain = ProtocolFactoryManager.ResolveProtocolChain(Defines.CONF_PROTOCOL_OUTBOUND_CLUSTER); return(TCPConnector <OutboundClusterProtocol> .Connect(endpoint, chain, parameters)); }
private void TCPConnectorConnectTest() { using (FileLog l = new FileLog("TCPConnectorConnectTest", new FileLogSettings() { DateFolderMask = "yyyy-MM-dd" })) using (TCPConnector connector = TCPConnector.Create()) { connector.Connect("Test", "@TestPassword"); l.Debug("Start performance test for logins"); int i = 0; for (i = 0; i < 1000; i++) { var dr = connector.Execute("Sys.Select", new DataPackage(new string[] { "ParamName", "ParamValue" }, new object[] { "_connectionName", "banklocal" })); //string s = (string)dr["ObjectSchema"]; } l.Debug($"End performance test for {i} logins"); } }