Esempio n. 1
0
        /// <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
            }));
        }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 internal SimpleSocketServer(ISimpleSocketHandler <T, R> handler, SimpleSocketConfig config = null)
 {
     _handler = handler;
     _config  = config;
     _cancel  = new CancellationTokenSource();
 }
Esempio n. 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="config"></param>
 public SimpleSocketClient(SimpleSocketConfig config = null)
 {
     this._config = config ?? new SimpleSocketConfig();
 }