/// <summary> /// 接收发送给本机ip对应端口号的数据报 /// </summary> private async Task ReciveMsgAsync() { while (true) { //IPEndPoint point = new IPEndPoint(IPAddress.Any, 0);//用来保存发送方的ip和端口号 //byte[] buffer = _socket.Receive(ref point);//接收数据报 var result = await _socket.ReceiveAsync(); _kcpChannel.MockInput(result.Buffer); } }
internal void MockInput(byte[] buf, int offset, int count) { _kcpChannel.MockInput(new Span <byte>(buf, offset, count)); }