Пример #1
0
 public void Send(IOconMessage msg, IOconPeer reciever)
 {
     if (RecievedMessageEvent != null)
     {
         RecievedMessageEvent(msg, Address);
     }
 }
Пример #2
0
        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));
                }
            }
        }
Пример #3
0
 public Message(IOconMessage msg, IOconPeer peer)
 {
     Peer = peer;
     Msg  = msg;
 }