3.3.4.4 SendReceive (Opnum 3)

The SendReceive method is invoked by one partner to transmit messages to the other partner. Both the primary and the secondary participants have the option to call this method multiple times after a session has been established between them.

 HRESULT SendReceive(
   [in] PCONTEXT_HANDLE phContext,
   [in, range(1, 4095)] DWORD dwcMessages,
   [in, range(40, 0x14000)] DWORD dwcbSizeOfBoxCar,
   [in, size_is(dwcbSizeOfBoxCar)] 
     unsigned char rguchBoxCar[]
 );

phContext: An RPC context handle, returned by a call to BuildContext or BuildContextW, correlated with a session object in the Active state. For context handles, see [C706].

dwcMessages: An unsigned 32-bit integer specifying the number of messages being sent.

dwcbSizeOfBoxCar: Size in bytes of the box car specified by rguchBoxCar.

rguchBoxCar: An array of bytes that contains the messages being sent.

Return Values: This method MUST return zero (0x00000000) on success. On failure, it MUST return either one of the values described in the following table of return values or an implementation-specific HRESULT. A client MUST NOT depend on implementation-specific failure HRESULT values. For more information about how the client SHOULD behave based on the possible return values, see section 3.4.6.4. Standard errors are defined in [MS-ERREF] section 2.2.

Return value/code

Description

0x00000000

ERROR_STATUS

The return value indicates success.

The table below describes the possible errors that SHOULD be returned by this method.

Return value/code

Description

0x80000119

E_CM_TEARING_DOWN

The session object is in the Requesting Teardown or Teardown state.

0x80000123

E_CM_SERVER_NOT_READY

The session object is not in the Active state.

The opnum field value for this method is 3, as specified in [C706].

For the structure and sequence of data on the wire, see [C706] section 14.

On receiving this method call, the receiving partner MUST verify that the contextHandle parameter is associated with a session object that is in the Active state. For context handles, see [C706]. If the session object is in the Requesting Teardown or Teardown state or it is not in the Active state, the partner MUST return from this method with an implementation-specific error code.

Otherwise, the operation of this method is determined by the level-two protocol that is layered on top of the MSDTC Connection Manager: OleTx Transports Protocol; the session object, the count of messages, and the byte array MUST be presented to the level-two protocol. It is this protocol that defines the format of the rguchBoxCar buffer and the messages contained therein. Similarly, any correlation between the dwcMessages parameter and the contents of the rguchBoxCar buffer lies strictly in the domain of the level-two protocol.