Ver código fonte

修复一个WChannel的bug

tanghai 3 anos atrás
pai
commit
e2d3aa7671
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      Unity/Assets/Mono/Module/NetworkTCP/WChannel.cs

+ 2 - 2
Unity/Assets/Mono/Module/NetworkTCP/WChannel.cs

@@ -88,8 +88,8 @@ namespace ET
 
         public void Send(MemoryStream stream)
         {
-            byte[] bytes = new byte[stream.Length];
-            Array.Copy(stream.GetBuffer(), bytes, bytes.Length);
+            byte[] bytes = new byte[stream.Length - stream.Position];
+            Array.Copy(stream.GetBuffer(), stream.Position, bytes, 0, bytes.Length);
             this.queue.Enqueue(bytes);
 
             if (this.isConnected)