public void Send(IPEndPoint point, RakNetPacket msg) { msg.Encode(); RakNetPacketSendEventArgs ev = new RakNetPacketSendEventArgs(point, msg); Server.Instance.Event.Network.OnRakNetPacketSend(this, ev); if (ev.IsCancel) { return; } msg = ev.Packet; byte[] buffer = msg.ToArray(); this.Client.Send(buffer, buffer.Length, point); }
public void QueueConnectedPacket(RakNetPacket packet, int reliability, int orderChannel, int flags = RakNetProtocol.FlagNormal) { packet.Encode(); EncapsulatedPacket pk = new EncapsulatedPacket(); pk.Reliability = reliability; pk.OrderChannel = orderChannel; pk.Buffer = packet.ToArray(); RakNetEncapsulatedSendEventArgs ev = new RakNetEncapsulatedSendEventArgs(this, pk); Server.Instance.Event.Network.OnRakNetEncapsulatedSend(this, ev); if (ev.IsCancel) { return; } pk = ev.Packet; this.AddEncapsulatedToQueue(pk, flags); }