/// <summary> /// Конструктор коммуникатора /// </summary> /// <param name="server">Сервер</param> /// <param name="clientFactory">Фаблика клиентов</param> public Communicator( ICommunicationServer <List <Block> > server, ICommunicationClientFactory <List <Block> > clientFactory) { this.server = server; this.clientFactory = clientFactory; nodes = new List <ICommunicationClient <List <Block> > >(); server.MessageReceivedEvent += Server_MessageReceivedEvent; server.ClientConnectedEvent += Server_ClientConnectedEvent; server.ClientDisconnectedEvent += Server_ClientDisconnectedEvent; server.Start(); }
static private void StartComponent(string[] pipeNames, string ipadr, int port) { if (pipeNames.Length > 0) { // Iniciando Pipe server _pipeServer = new HeartbeatServer(pipeNames, _enc); _pipeServer.MessageReceivedEvent += PipeServer_MessageReceived; _pipeServer.Start(); Builder.Output("Iniciando _pipeServer."); } // Iniciando UdpServer _udpServer = new HeartbeatServer(ipadr, port, _enc); _udpServer.MessageReceivedEvent += UdpServer_MessageReceived; _udpServer.Start(); Builder.Output("Iniciando _udpServer."); }
public void Start() { if (IsServer) { server.ConnectionRecieved += server_ConnectionRecieved; server.Start(initArgs); } else { conn = client.Connect(initArgs); while (conn.IsConnected) { MessageReceived.RaiseEvent(this, conn.Receive()); } Environment.Exit(1); } }
public void Start() { _server.DataReceived += OnDataReceived; _server.Start(); }
public void Start() { _server.Start(); }