示例#1
0
        public void Broadcast <T>(T packet)
        {
            var socket           = _udpSocketListener.GetSocket();
            var serialisedPacket = _packetSerialiser.Serialise(packet);

            socket.Send(serialisedPacket);
        }
示例#2
0
        public void SendTo <T>(T packet, IPEndPoint endpoint)
        {
            var socket           = _udpSocketListener.GetSocket();
            var serialisedPacket = _packetSerialiser.Serialise(packet);

            socket.SendTo(serialisedPacket, endpoint);
        }
示例#3
0
        public void Broadcast <T>(T packet)
        {
            if (UdpListener == null)
            {
                throw new Exception("UDP is not enabled");
            }

            var socket = UdpListener.GetSocket();

            socket.EnableBroadcast = true;
            socket.SendTo(packetSerialiser.Serialise(packet), new IPEndPoint(IPAddress.Broadcast, this.options.UdpPort));
        }
示例#4
0
 public void Send <T>(T packet)
 {
     Socket.Send(_packetSerialiser.Serialise(packet));
 }
示例#5
0
 public void Broadcast <T>(T packet) => Broadcast(packetSerialiser.Serialise(packet));