Ejemplo n.º 1
0
        public void RunAgent()
        {
            var socket = ConnectToServer();
            if (socket == null)
            {
                Log.Error("Could not establish a connection to the server, aborting...");
                return;
            }

            networkClient = new NetworkClient(socket);
            //networkClient.MessageReceived += AgentOnMessageReceived;

            var agentInfo = new BuildAgentInfoMessage
            {
                MachineName = Environment.MachineName
            };

            networkClient.Send(NetworkMessageKind.BuildAgentInfo, agentInfo);

            while (networkClient.IsActive)
            {
                var task = networkClient.GetMessage();
                task.Wait();

                var message = task.Result;
                OnServerMessage(networkClient, message);
            }
        }
Ejemplo n.º 2
0
        public void RunAgent()
        {
            var socket = ConnectToServer();

            if (socket == null)
            {
                Log.Error("Could not establish a connection to the server, aborting...");
                return;
            }

            networkClient = new NetworkClient(socket);
            //networkClient.MessageReceived += AgentOnMessageReceived;

            var agentInfo = new BuildAgentInfoMessage
            {
                MachineName = Environment.MachineName
            };

            networkClient.Send(NetworkMessageKind.BuildAgentInfo, agentInfo);

            while (networkClient.IsActive)
            {
                var task = networkClient.GetMessage();
                task.Wait();

                var message = task.Result;
                OnServerMessage(networkClient, message);
            }
        }