internal static void SendToClient(Packet p) { var len = (int)p.Length; var pack = p.Compile(); _sendToClient?.Invoke(ref pack, ref len); }
public static void SendPacketToClient(byte[] packet, int length) { lock ( _clientSendLock ) { while (DateTime.Now < _nextPacketRecvTime) { Thread.Sleep(1); } InternalPacketReceivedEvent?.Invoke(packet, length); _sendToClient?.Invoke(ref packet, ref length); _nextPacketRecvTime = DateTime.Now + PACKET_RECV_DELAY; } }
public static void SendPacketToServer(byte[] packet, int length) { lock ( _serverSendLock ) { while (DateTime.Now < _nextPacketSendTime) { Thread.Sleep(1); } InternalPacketSentEvent?.Invoke(packet, length); _sendToServer?.Invoke(ref packet, ref length); _nextPacketSendTime = DateTime.Now + PACKET_SEND_DELAY; } }
public static void SendPacketToServer(byte[] packet, int length) { lock ( _serverSendLock ) { while (DateTime.Now < _nextPacketSendTime) { Thread.Sleep(1); } InternalPacketSentEvent?.Invoke(packet, length); PacketWaitEntries?.CheckWait(packet, PacketDirection.Outgoing, true); _sendToServer?.Invoke(ref packet, ref length); _nextPacketSendTime = DateTime.Now + PACKET_SEND_DELAY; } }
public static void SendPacketToClient(byte[] packet, int length) { try { lock ( _clientSendLock ) { while (DateTime.Now < _nextPacketRecvTime) { Thread.Sleep(1); } InternalPacketReceivedEvent?.Invoke(packet, length); _sendToClient?.Invoke(ref packet, ref length); _nextPacketRecvTime = DateTime.Now + PACKET_RECV_DELAY; } } catch (ThreadInterruptedException) { // Macro was interupted whilst we were waiting... } }
public static void SendPacketToClient(byte[] packet, int length) { InternalPacketReceivedEvent?.Invoke(packet, length); _sendToClient?.Invoke(ref packet, ref length); }
public static void SendPacketToServer(byte[] packet, int length) { InternalPacketSentEvent?.Invoke(packet, length); _sendToServer?.Invoke(ref packet, ref length); }
internal static void SendToClient(Packet p) { var len = p.Length; _sendToClient?.Invoke(p.Compile(), (int)len); }