public void Broadcast <T>(T packet) { var socket = _udpSocketListener.GetSocket(); var serialisedPacket = _packetSerialiser.Serialise(packet); socket.Send(serialisedPacket); }
public void SendTo <T>(T packet, IPEndPoint endpoint) { var socket = _udpSocketListener.GetSocket(); var serialisedPacket = _packetSerialiser.Serialise(packet); socket.SendTo(serialisedPacket, endpoint); }
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)); }
public void Send <T>(T packet) { Socket.Send(_packetSerialiser.Serialise(packet)); }
public void Broadcast <T>(T packet) => Broadcast(packetSerialiser.Serialise(packet));