/// <summary> /// Expect rap response payLoadPacket from server /// </summary> /// <param name="timeout">timeout</param> /// <returns>The rap response packet</returns> /// <exception cref="System.InvalidOperationException">Thrown if there is any error occurred</exception> public virtual FsRapResponse ExpectRapPayload(TimeSpan timeout) { this.internalTimeout = timeout; SmbPacket packet = smbClient.ExpectPacket(timeout); if (packet is SmbErrorResponsePacket) { throw new InvalidOperationException(string.Format( "The server returns error, the error code is 0x{0:x}", packet.SmbHeader.Status)); } SmbTransRapResponsePacket transResponse = packet as SmbTransRapResponsePacket; FsRapResponse responsePacket = new FsRapResponse(); responsePacket.messageId = transResponse.SmbHeader.Mid; responsePacket.TransParameters = new RapResponseParam(); responsePacket.TransParameters.Converter = transResponse.TransParameters.Converter; responsePacket.TransParameters.RAPOutParams = transResponse.TransParameters.RAPOutParams; responsePacket.TransParameters.Win32ErrorCode = transResponse.TransParameters.Win32ErrorCode; responsePacket.TransData = new RapResponseData(); responsePacket.TransData.RAPOutData = transResponse.TransData.RAPOutData; return(responsePacket); }
/// <summary> /// Expect rap response payLoadPacket from server /// </summary> /// <param name="timeout">timeout</param> /// <returns>The rap response packet</returns> /// <exception cref="System.InvalidOperationException">Thrown if there is any error occurred</exception> public virtual FsRapResponse ExpectRapPayload(TimeSpan timeout) { this.internalTimeout = timeout; SmbPacket packet = smbClient.ExpectPacket(timeout); if (packet is SmbErrorResponsePacket) { throw new InvalidOperationException(string.Format( "The server returns error, the error code is 0x{0:x}", packet.SmbHeader.Status)); } SmbTransRapResponsePacket transResponse = packet as SmbTransRapResponsePacket; FsRapResponse responsePacket = new FsRapResponse(); responsePacket.messageId = transResponse.SmbHeader.Mid; responsePacket.TransParameters = new RapResponseParam(); responsePacket.TransParameters.Converter = transResponse.TransParameters.Converter; responsePacket.TransParameters.RAPOutParams = transResponse.TransParameters.RAPOutParams; responsePacket.TransParameters.Win32ErrorCode = transResponse.TransParameters.Win32ErrorCode; responsePacket.TransData = new RapResponseData(); responsePacket.TransData.RAPOutData = transResponse.TransData.RAPOutData; return responsePacket; }