/// <summary> /// /// </summary> /// <param name="handler"></param> /// <param name="config"></param> /// <returns></returns> public static ISimpleSocketServer CreateServer <T, R>(ISimpleSocketHandler <T, R> handler, SimpleSocketConfig config = null) { if (null == handler) { throw new ArgumentNullException("handler"); } var port = SimpleSocketConfig.DEFAULT_PORT; if (typeof(T) == typeof(AuthProtocol)) { port = AuthProtocol.DefaultPort; } return(new SimpleSocketServer <T, R>(handler, config ?? new SimpleSocketConfig { Port = port })); }
/// <summary> /// /// </summary> internal SimpleSocketServer(ISimpleSocketHandler <T, R> handler, SimpleSocketConfig config = null) { _handler = handler; _config = config; _cancel = new CancellationTokenSource(); }
/// <summary> /// /// </summary> /// <param name="config"></param> public SimpleSocketClient(SimpleSocketConfig config = null) { this._config = config ?? new SimpleSocketConfig(); }