Пример #1
0
        public void ApproveJoinAnt(int id, IEnumerable<JObject> network)
        {
            _localAnt.SetId(id);
            _ants[_localAnt.GetAnts().GetId()].JoinAnt(_localAnt);
            foreach (var ant_packet in network)
            {
                var ants = _ants[ant_packet.Value<int>("ant")];
                var ant = new RemoteAnt(ants, ant_packet.Value<int>("id"));
                ants.JoinAnt(ant);

                int port = ant_packet.Value<int>("port");
                foreach (var host in ant_packet.Value<JArray>("host").Values<byte[]>())
                {
                    AntPipeline.GetAntPipeline().AddPipeline(ant, new IPEndPoint(new IPAddress(host), port));
                }
                //이제 실질적으로 소켓 연결
            }
            _queenChannel.SendMessage("start_ant", null);
            _localAntModel.OnStart();
        }
Пример #2
0
 public void HelloAnt(IChannel channel, int antsId, int id)
 {
     var ants = _ants[antsId];
     var ant = new RemoteAnt(ants, id);
     ant.AddChannel(channel);
     ants.JoinAnt(ant);
 }