/// <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); } }
/// <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)); } } }
/// <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) { } } } }