public static bool Start() { lock (KFCallManager.Mutex) { KFCallManager.KFClient oldClient = KFCallManager.Current; string host = null; int port = 0; string uri = ConfigurationManager.AppSettings.Get("KFService"); if (!string.IsNullOrEmpty(uri)) { string[] array = uri.Split(new char[] { ':' }); if (array.Length == 2 && int.TryParse(array[1], out port) && port > 0 && port < 65535) { host = array[0]; } } if (!string.IsNullOrEmpty(host)) { if (oldClient != null) { if (KFCallManager.Host != host || KFCallManager.Port != port) { oldClient.OnSetSocket = null; KFCallManager.NewKFClient(host, port); oldClient.Dispose(); } } else { KFCallManager.NewKFClient(host, port); } } else if (null != oldClient) { oldClient.OnSetSocket = null; oldClient.Dispose(); } } return(true); }
private static void OnSetSocket(KFCallManager.KFClient client) { client.KeepGetMessage = TcpCall.KFServiceBase.KeepGetMessage(new Action <ReturnValue <KFCallMsg> >(KFCallManager.KFCallMsgFunc)); }