public static RemoteNode FromName(string Name) { //add link capability string[] Sections = Name.Split('.'); int Len = Sections[0].Length + Sections[1].Length + Sections[2].Length + Sections[3].Length + 3; IPAddress Address = IPAddress.Parse(Name.Substring(0, Len)); CDSMessageHandler h = new CDSMessageHandler(Address); RemoteNode n = ((CDSRemoteAgent)h.OpenChannel()).Root; for (int i = 4; i < Sections.Length; i++) { n = (RemoteNode)n.ChildByName(Sections[i]); } return n; }
static void Listen() { if (listener.Pending()) { Console.WriteLine("Adding connection"); TcpMessageEncap m = new TcpMessageEncap(listener.AcceptTcpClient()); ChannelEncap c = new ChannelEncap(m); CDSMessageHandler h = new CDSMessageHandler(c); AcceptedConnections.Add(h); m.Init(); } for (int i = 0; i < AcceptedConnections.Count; i++) { if (!AcceptedConnections[i].chan.MessageProvider.Alive) { Console.WriteLine("Removing connnection"); AcceptedConnections.RemoveAt(i); i--; } } Task.Factory.StartNew(Listen); }
public abstract Agent Open(int ChannelID, CDSMessageHandler Handler);