Пример #1
0
 /// <summary>
 /// Broadcasts a message from this node that it would like to
 /// participate in a cluster.
 /// </summary>
 public override void Send(ClusterMessage message)
 {
     lock (_udpLock)
     {
         var packet = message.ToPacket();
         _client.Send(packet, packet.Length, _broadcast);
     }
 }
Пример #2
0
 /// <summary>
 /// Sends to all known cluster nodes specifically without using
 /// a broadcast.
 /// </summary>
 public override void SendAll(ClusterMessage message)
 {
     lock (_udpLock)
     {
         var packet = message.ToPacket();
         foreach (var node in ClusterNetwork.Current.Nodes)
         {
             _client.Send(packet, packet.Length, Util.NetUtil.CreateIPEndPoint(node.IP, _port));
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Sends the host message directly to an IP, in case it can't
 /// seem to see the broadcasts.
 /// </summary>
 public override void Send(string ip, ClusterMessage message)
 {
     lock (_udpLock)
     {
         var packet = message.ToPacket();
         try
         {
             _client.Send(packet, packet.Length, Util.NetUtil.CreateIPEndPoint(ip, _port));
         }
         catch (Exception ex)
         {
             if (ex != null)
             {
             }
         }
     }
 }