110,538
社区成员
发帖
与我相关
我的任务
分享
byte[] byteOne = new byte[] { 12, 21, 33, 44, 55, 66, 87, 18, 29, 0, 0, 0, 0, 0 };
byte[] byteTwo = new byte[] { 10, 11, 12, 13, 14 };
byte[] q = byteOne.Concat(byteTwo).Where(a=>(int)a>0).ToArray();
public byte[] byteAdd(byte[] pre, byte[] data)
{
byte[] tempdata = new byte[ pre.Length + data.Length];
Array.Copy(pre, 0, tempdata, 0, pre.Length);
Array.Copy(data, 0, tempdata, pre.Length, data.Length);
return tempdata;
}
ClientConnService.localSocket.Receive(bufData, 2, 0);
int len0 = bufData[0] * 1;
int len1 = bufData[1] * 255;
int len = len0 + len1;
byteGather = new byte[len];
while (len > 0)
{
bufData = new byte[len];
int recIndex = ClientConnService.localSocket.Receive(bufData, len, 0);
len = len - recIndex;
}
byte[] byteOne = new byte[] { 12, 21, 33, 44, 55, 66, 87, 18, 29, 0, 0, 0, 0, 0 };
byte[] byteTwo = new byte[] { 10, 11, 12, 13, 14};
int start = Array.IndexOf(byteOne, (byte)0);
Array.Copy(byteTwo, 0, byteOne,start , (byteTwo.Length > byteOne.Length - start? byteOne.Length - start: byteTwo.Length) );