private unsafe int send_Hook(IntPtr socket, IntPtr buffer, int length, int flags) { if (_socket == socket) { if (length > ushort.MaxValue || length == 0) { return(Ws2_32.send(socket, buffer, length, flags)); } _clientPackets++; byte[] data = buffer.ExtractBuffer(length); switch (_clientPackets) { case 1: cKey1 = data; break; case 2: cKey2 = data; break; default: return(PacketController.ProcessClientData(data)); } return(Ws2_32.send(socket, buffer, length, flags)); } return(Ws2_32.send(socket, buffer, length, flags)); }
public unsafe int SendToServer(byte[] buffer) { fixed(byte *uBuffer = buffer) return(Ws2_32.send(_socket, (IntPtr)uBuffer, buffer.Length, 0)); }