Ejemplo n.º 1
0
        /// <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();
        }
Ejemplo n.º 2
0
 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.");
 }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
 public void Start()
 {
     _server.DataReceived += OnDataReceived;
     _server.Start();
 }
Ejemplo n.º 5
0
 public void Start()
 {
     _server.Start();
 }