Brecham.Obex — An OBEX library for the .NET Framework

ObexPduFactory.ParseForLength Method (Boolean, Byte[], Int32, Int32, Int32)

[This is preliminary documentation and subject to change.]

Check whether we have all the bytes that the PDU contains. Throws if the PDU being received is bigger than the receive buffer. This should not happen, as we told the peer at connect time what size our buffer was.

[Visual Basic]
Overloads Public Sub ParseForLength( _
   ByVal throwIfLongerThanMru As Boolean, _
   ByVal buffer As Byte(), _
   ByVal length As Integer, _
   ByRef extraLengthRequired As Integer, _
   ByRef pduLength As Integer _
)
[C#]
public void ParseForLength(
   bool throwIfLongerThanMru,
   byte[] buffer,
   int length,
   out int extraLengthRequired,
   out int pduLength
);

Remarks

Check whether we have all the bytes that the PDU contains. Throws if the PDU being received is bigger than the receive buffer. This should not happen, as we told the peer at connect time what size our buffer was.

  1. If the buffer contains *exactly* the expectedReqs number of bytes then extraLengthRequired is ZERO.
  2. If the buffer has *less* bytes than required then extraLengthRequired is POSITIVE. The caller should read that number of bytes from the stream or socket and re-call this function.
  3. If the nbuffer gas *more* bytes than required then extraLengthRequired is NEGATIVE.

Exceptions

Exception Type Condition
ArgumentNullException buffer is null.
ArgumentOutOfRangeException length is invalid, must be positive and within the range of MaximumMru, ie in the range of UInt16.
ProtocolViolationException

The length field in the PDU is invalid, for instance has a value less than the minimum (3).

– or –

The PDU being received is bigger than the local maximum receive size (LocalMru).

See Also

ObexPduFactory Class | Brecham.Obex.Pdus Namespace | ObexPduFactory.ParseForLength Overload List