Exemplo n.º 1
0
 public CamoranClientListener_ByHelios(string address, int port, ISerializeProcessor serializor, bool IsIPAddressAny)
 {
     if (port <= 0)
     {
         throw new ArgumentOutOfRangeException("port value must be larger than 0");
     }
     if (!IsIPAddressAny && string.IsNullOrEmpty(address))
     {
         throw new ArgumentNullException("address can't be null or empty");
     }
     _heliosServer = new Server(address, port, this, serializor, IsIPAddressAny);
     //new ProtoBufSerializeProcessor());
 }
 public CamoranBorkerBootstrap SetSerializer(ISerializeProcessor serializer)
 {
     return(this);
 }
Exemplo n.º 3
0
            public Server(string address, int port, IClientListener <Request, Response> listener, ISerializeProcessor sp, bool isIPAddressAny)
            {
                this._address       = address;
                this._port          = port;
                this._lisenter      = listener;
                this.SP             = sp;
                this.isAnyIPAddress = isIPAddressAny || string.IsNullOrEmpty(_address);

                var excutor = new TryCatchExecutor((e) =>
                {
                    //Console.Write(e);
                });
                var bootStrapper = new ServerBootstrap()
                                   .Executor(excutor)
                                   .SetTransport(System.Net.TransportType.Tcp)
                                   .Build();

                _server = bootStrapper.NewReactor(
                    NodeBuilder.BuildNode()
                    .Host(isIPAddressAny? IPAddress.Any:IPAddress.Parse(_address))
                    .WithPort(port)
                    );

                _server.OnConnection    += _server_OnConnection;;
                _server.OnDisconnection += TempServer_OnDisconnection;
            }
Exemplo n.º 4
0
 public CamoranClientListener_ByHelios(string address, int port, ISerializeProcessor serializor)
     : this(address, port, serializor, false)
 {
 }