Example #1
0
 internal Message(Node to, string content)
 {
     Id = Guid.NewGuid().ToString();
     To = to.GUID.ToString();
     From = "anonymous";
     Content = content;
     TTL = 255;
 }
Example #2
0
 internal Message(Node to, Node from, string content)
 {
     Id = Guid.NewGuid().ToString();
     To = to.GUID.ToString();
     From = from.GUID.ToString();
     TTL = 255;
     Content = content;
 }
Example #3
0
 public QuickLinkService()
 {
     ReceivedMessages = new List<Message>();
     local = new Node();
     local.MessageReceived += Local_MessageReceived;
     service = new Service(local);
     service.FoundAddress += Service_FoundAddress;
     service.FoundServer += Service_FoundServer;
     service.LostServer += Service_LostServer;
 }
Example #4
0
        /* ==== CONSTRUCTORS ===== */
        internal Service(Node _local, ServiceType _type = ServiceType.Full)
        {
            Type = _type;
            _local.Local = true;
            Nodes = new List<Node> { _local };
            Connections = new List<ServiceConnection>();

            Thread thread = new Thread(ReconnectServers);
            thread.Start();
        }
Example #5
0
 private void AnnounceOneNodeToServer(Node node, ServiceConnection service)
 {
     service.Send(node.ToString());
 }
Example #6
0
 private void AnnounceOneNodeToAllServers(Node node)
 {
     foreach (ServiceConnection connection in Connections.Where(i => i.Client.Connected))
     {
         connection.Send(node.ToString());
     }
 }
Example #7
0
 internal string MakeNode()
 {
     var node = new Node();
     node.Local = true;
     Nodes.Add(node);
     return node.GUID.ToString();
 }