/// <summary> /// Construct a nEw MewLabs Tcp Server /// </summary> /// <param name="ip">Tye IpAddress of the server</param> /// <param name="type">The type of communication the server uses (tcp,tls,udp)</param> /// <param name="port">The port the server listens on</param> /// <param name="parser">The parser that is needed to parse the protocol send over the Tcp Communication, NUll by default will use the RawProtocol Parser</param> public NekoIOLabsServer(IPAddress ip, NEKOIOLABS_COMMUNICATION_TYPE type, int port, IProtocolParser parser = null, ILogger logger = null) { try { if (parser == null) { _protocolParser = new RawProtocolParser(); } else { _protocolParser = parser; } //check if they plugged in a logger other wise use default logger if (Logger == null) { if (logger == null) { _logger = new SimpleDebugLogger(); } else { _logger = logger; } } SetCommuncations(type, ip, port); _connectedClients = new List <NekoIOLabsConnectedClient>(); serverCommunication.OnClientConnected += ServerCommunication_OnClientConnected; } catch (Exception ex) { throw new Exception("creation of server failed"); } }
public RoomClient(IBaseSocketClient socketClient, IPool <byte[]> bytesPool, IPool <IRoomCommand> poolCommandPool, IProtocolParser protocol) { if (bytesPool == null) { throw new ArgumentNullException(nameof(bytesPool)); } if (poolCommandPool == null) { throw new ArgumentNullException(nameof(poolCommandPool)); } if (protocol == null) { throw new ArgumentNullException(nameof(protocol)); } if (socketClient == null) { throw new ArgumentNullException(nameof(socketClient)); } _protocol = protocol; _poolCommand = poolCommandPool; _baseSocketClient = socketClient; _baseSocketClient.Disconnect += OnDisconnect; _baseSocketClient.AfterSend += (s, e) => bytesPool.Free(e.Buffer); //возвращаем данные в пул после отправки, для повторного использования _baseSocketClient.AfterReceive += OnAfterReceive; }
public CommandSystem(IProtocolParser protocolParser, ITcpServer server) { m_protocolParser = protocolParser; m_commandContainer = new Dictionary <string, ICommand>(); //m_commandContainer.Add("Stop Service", new StopService()); m_commandContainer.Add("Show Command Code", this); m_commandContainer.Add("Send HeartBeat", new SendHeartBeat(protocolParser)); m_commandContainer.Add("ShutdownClient", new ShutdownClient(server)); m_commandContainer.Add("Send LoginAck", new SendLoginAck(protocolParser)); }
public PenCommV1(PenCommV1Callbacks callback, IProtocolParser parser = null, IMetadataManager metadataManager = null) : base(parser == null ? parser = new ProtocolParserV1() : parser, metadataManager) { Callback = callback; Parser.PacketCreated += Parser_PacketCreated; dotFilterForPage = new FilterForPaper(SendDotReceiveEvent); // 오프라인 데이터 처리 if (mOfflineworker == null) { mOfflineworker = new OfflineWorker(this); mOfflineworker.Startup(null); } }
public SendHeartBeat(IProtocolParser protocolParser) { m_protocolParser = protocolParser; }
protected internal PenComm(IProtocolParser _parser, IMetadataManager metadataManager = null) { Parser = _parser; MetadataManager = metadataManager; }
protected internal PenComm(IProtocolParser _parser) { Parser = _parser; }
public SendLoginAck(IProtocolParser protocolParser) { m_protocolParser = protocolParser; }
public RemoteClient(IBaseSocketClient socketClient, IPool <byte[]> bytesPool, IPool <IRoomCommand> poolCommandPool, IProtocolParser protocol) : base(socketClient, bytesPool, poolCommandPool, protocol) { }
public ProtocolOrchestratorService(IProtocolParser protocolParser, IProtocolInterpreter protocolInterpreter) { _protocolParser = protocolParser; _protocolInterpreter = protocolInterpreter; }