public void Send(IOconMessage msg, IOconPeer reciever) { if (RecievedMessageEvent != null) { RecievedMessageEvent(msg, Address); } }
public void Broadcast(IOconMessage msg) { foreach ( var localIp in Dns.GetHostAddresses(Dns.GetHostName()) .Where(i => i.AddressFamily == AddressFamily.InterNetwork)) { using (var client = new UdpClient()) { client.MulticastLoopback = true; client.JoinMulticastGroup(_multicastAddress); var bytes = _serializer.Serialize(new Message(msg, Address)).GetBytes(); client.Send(bytes, bytes.Length, new IPEndPoint(_multicastAddress, MulticastPort)); } } }
public Message(IOconMessage msg, IOconPeer peer) { Peer = peer; Msg = msg; }