# IRsNtMsgClientHandler Interface Reference

Inherits IRsObject.

List of all members.

## Public Member Functions
HRESULT | DataMsgReceived ([in] RtCSNID csnidClient,[in] RtBYTE *pData,[in] RtDWORD dwDataSize,[in] RtNtHANDLE hBufferHandle)
HRESULT | MsgSentComplette ([in] RtNtHANDLE hAsyncOp,[in] RtPVoid pvUserContext,[in] HRESULT hResultCode,[in] RtDWORD dwSendTime)
HRESULT | ReturnBuffer ([in] RtPVoid pvContext,[in] RtPVoid pvBuffer)
HRESULT | ConnectComplete ([in] HRESULT hResultCode,[in] RtBYTE *pConnectReplyData,[in] RtDWORD dwConnectReplyDataSize)
HRESULT | Disconnected ([in] HRESULT hResultCode,[in] RtBYTE *pDisconnectData,[in] RtDWORD dwDisconnectDataSize)

## Detailed Description

Interface allows you to hook on client network wrapper IRsClient and receive notifications.

## Member Function Documentation

HRESULT IRsNtMsgClientHandler::DataMsgReceived | ( | [in] RtCSNID | csnidClient,
|  | [in] RtBYTE * | pData,
|  | [in] RtDWORD | dwDataSize,
|  | [in] RtNtHANDLE | hBufferHandle |
| ) |  |  |

Called when a data message is received.

Parameters:

  | csnidClient | [in] Client's ID.
  | pvData | [in] Pointer to the received data.
  | dwDataSize | [in] Size of the received data.
  | hBufferHandle | [in] Handle of the buffer.

Returns:
  Return RSNTSUCCESS_PENDING if you take ownership of the buffer. Otherwise return S_OK. For the pending, when you will not need the buffer, call IRsServer::ReturnBuffer method to return it.

HRESULT IRsNtMsgClientHandler::MsgSentComplette | ( | [in] RtNtHANDLE | hAsyncOp,
|  | [in] RtPVoid | pvUserContext,
|  | [in] HRESULT | hResultCode,
|  | [in] RtDWORD | dwSendTime |
| ) |  |  |

If specified, this method is called when the message sent process finishes.

Parameters:

  | hAsyncOp | [in] Handle of the send operation.
  | pvUserContext | [in] Pointer to the user context.
  | hResultCode | [in] Result code of the send operation.
  | dwSendTime | [in] The sending time.

HRESULT IRsNtMsgClientHandler::ReturnBuffer | ( | [in] RtPVoid | pvContext,
|  | [in] RtPVoid | pvBuffer |
| ) |  |  |

Called to return a buffer after an asynchronious operation.

Parameters:

  | pvContext | [in] Pointer to user context.
  | pvBuffer | [in] Pointer to the buffer that is returned.

HRESULT IRsNtMsgClientHandler::ConnectComplete | ( | [in] HRESULT | hResultCode,
|  | [in] RtBYTE * | pConnectReplyData,
|  | [in] RtDWORD | dwConnectReplyDataSize |
| ) |  |  |

Called to inform about the attempt to connect.

Parameters:

  | hResultCode | [in] Result code of the connect operation.
  | pConnectReplyData | [in] Pointer to the reply data message sent by server (if any).
  | dwConnectReplyDataSize | [in] Size of the reply data message.

HRESULT IRsNtMsgClientHandler::Disconnected | ( | [in] HRESULT | hResultCode,
|  | [in] RtBYTE * | pDisconnectData,
|  | [in] RtDWORD | dwDisconnectDataSize |
| ) |  |  |

Called to inform the connection has terminated.

Parameters:

  | hResultCode | [in] Result code why the connection was terminated. It can be one of the following: RSNTERR_SERVERTERMINATEDSESSION - if Server terminated session. RSNTERR_CONNECTIONLOST - if the connection was lost.
  | pDisconnectData | [in] Pointer to the disconnection data message sent by server (if any).
  | dwDisconnectDataSize | [in] Size of the disconnection data message.