Partager via


IRTC::Connect

The Connect method connects the NPP to the network by using a specified NIC and provides configuration information for the connection.

HRESULT STDMETHODCALLTYPE Connect(HBLOBhInputBlob,
LPVOIDStatusCallbackProc,
LPVOIDFramesCallbackProc,
LPVOIDUserContext,
HBLOBhErrorBlob);

Parameters

  • hInputBlob
    [in] Handle to the BLOB that specifies the NIC that you are connecting to and the configuration information for that connection.
  • StatusCallbackProc
    [in] Address of the user's status callback function, which receives status updates such as triggers. This parameter can be set to NULL.
  • FramesCallbackProc
    [in] Address of the user's frame callback function, which is used to receive status updates such as triggers. This parameter can be set to NULL.
  • UserContext
    [in] Value passed when the user's status and frame callback function is called. If both callback functions are specified, they must use the same user-context value. The value of this parameter is typically either HWND or a 'this' pointer.
  • hErrorBlob
    [out] Handle to an error BLOB that contains additional error information. See Remarks at the bottom of this topic for information about what is in the error BLOB.

Return Values

If this method is successful, the return value is NMERR_SUCCESS.

If the method is unsuccessful, the return value is one of the following error codes (which include those errors returned by the internal IRTC::Configure call):

Return code Description
NMERR_ALREADY_CONNECTED This instance of the NPP COM object is already connected to the network.
NMERR_BLOB_CONVERSION_ERROR The configuration BLOB is corrupt. This error is generated by the IRTC::Configure call.
NMERR_BLOB_ENTRY_DOES_NOT_EXIST The input BLOB specified by the hInputBlob parameter lacks an entry needed to perform this operation. This error may be generated by the IRTC::Connect or IRTC::Configure call. Look at the error BLOB returned by hErrorBlob to determine which entry was not found.
NMERR_BLOB_NOT_INITIALIZED The CreateBlob function has not been called. This error is generated by the IRTC::Configure call.
NMERR_BLOB_STRING_INVALID The string is not null-terminated. This error is generated by the IRTC::Configure call.
NMERR_ILLEGAL_TRIGGER The trigger portion of the input BLOB is corrupt. This error is generated by the IRTC::Configure call.
NMERR_INVALID_BLOB The object specified in hInputBlob is not a BLOB. This error is generated by the IRTC::Configure call.
NMERR_OUT_OF_MEMORY The memory needed to perform this operation is unavailable. This error is generated by the IRTC::Configure call.
NMERR_TIMEOUT The request has timed out. This error is generated by the IRTC::Configure call.
NMERR_UPLEVEL_BLOB The version number of the BLOB specified in hInputBlob is incorrect. This error is generated by the IRTC::Configure call.

Remarks

When the Connect method is called, the NPP automatically calls the IRTC::Configure method by using the BLOB provided by hInputBlob. Note that any error codes returned by the call to IRTC::Configure are passed back and returned by the IRTC::Connect call.

This method must be called before you can start capturing frames. Note that when you connect to the network using this method, you must continue to use the IRTC interface to capture frames.

When calling this function, you must specify a status or frame callback function, even if it only acts as a placeholder.

The input BLOB specified by hInputBlob can be obtained by calling the GetNPPBlobFromUI, GetNPPBlobTable, and SelectNPPBlobFromTable methods.

The error BLOB returned in hErrorBlob contains error information that the developer or the application can use for troubleshooting. The error BLOB returned by hErrorBlob contains entries that Network Monitor could not understand or find in the input BLOB specified in hInputBlob. For example, if NMERR_BLOB_ENTRY_DOES_NOT_EXIST is returned, the entry Network Monitor could not find is included in the returned error BLOB.

For information about See
Obtaining the input BLOB that represents a NIC Selecting a Network Interface Card

Requirements

Client Requires Windows XP, Windows 2000 Professional, or Windows NT Workstation 4.0.
Server Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.
Header

Declared in Netmon.h.

DLL Requires Ndisnpp.dll. Requires Rmtnpp.dll.

See Also

IRTC::Configure, IRTC::Disconnect, IRTC::Start