protected virtual void SendPack(Pack pack) { byte[] msgByteArray = pack.Assembly(); try { m_stream.BeginWrite(msgByteArray, 0, msgByteArray.Length, //new AsyncCallback(TCPSendCallBack), pack.MessageID); new AsyncCallback(TCPSendCallBack), System.DateTime.Now.Ticks); m_stream.Flush(); } catch (Exception e) { Debug.LogError(m_type + " NetworkConn.SendPack, Msg:" + pack.MessageID + " Error: " + e.Message); } }
protected override void SendPack(Pack pack) { byte[] msgByteArray = pack.Assembly(); lock (m_stream) { try { m_stream.Seek(0, SeekOrigin.End); m_stream.BeginWrite(msgByteArray, 0, msgByteArray.Length, //new AsyncCallback(TCPSendCallBack), pack.MessageID); new AsyncCallback(TCPSendCallBack), System.DateTime.Now.Ticks); m_stream.Flush(); } catch (Exception e) { m_stream.Seek(0, SeekOrigin.Begin); m_stream.SetLength(0); Debug.LogError(m_type + " NetworkConn.SendPack, Msg:" + pack.MessageID + " Error: " + e.Message); } } }