private void DoSend(byte[] data, Protocal type = Protocal.Tcp) { //SafeDebug.Log("Sending some shit 1"); if (type == Protocal.Tcp || !udpStarted) { //SafeDebug.Log("Sending some shit 2"); if (tcpClient != null && tcpSocket != null) { //if ((ServerCMD)data[0] != ServerCMD.Ping) // SafeDebug.Log("SENDING: " + (ServerCMD)data[0]); data = BufferUtils.AddLength(data); //SafeDebug.Log("Sending some shit 3"); tcpSocket.Send(data); } else { SafeDebug.LogError("Client TCP socket null!"); } } else { if (udpClient != null) { byte[] udpIdBuff = BitConverter.GetBytes((UInt16)UdpID); byte[] buffer = BufferUtils.Add(udpIdBuff, data); udpClient.Send(buffer, buffer.Length); } else { DoSend(data); } } }