8,735
社区成员
发帖
与我相关
我的任务
分享
byte[] aryRet = ........
byte[] aryIPPort=...........
//将ip信息和视频流分别copy到发送流中发送
byte[] ary = new byte[aryRet.Length + aryIP.Length];
Array.Copy(aryIP, ary, aryIP.Length);
Array.Copy(aryRet, 0, ary, aryIP.Length, aryRet.Length);
Socket对象.Send(ary);
protected void StartReceiving()
{
byte[] response = new byte[30018];
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.Completed += OnReceiveCompleted;
socketEventArg.SetBuffer(response, 0, response.Length);
client_socket.ReceiveAsync(socketEventArg);
}
protected void OnReceiveCompleted(object sender, SocketAsyncEventArgs e)
{
this.Dispatcher.BeginInvoke(new mydelegate(ViewReceived), e.Buffer);
}
private void ViewReceived(byte[] buffer)
{
string strIPPort = Encoding.UTF8.GetString(buffer, 0, 18);
MemoryStream ms = new MemoryStream(buffer, 18, buffer.Length - 18);
}