Share via


IStats::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,
LPVOIDUserContext,
HBLOBhErrorBlob);

Parameters

  • hInputBlob
    [in] Handle to the BLOB that specifies the NIC that the NPP connects to and the configuration information for that connection.
  • StatusCallbackProc
    [in] Address of the user's callback function, which receives status updates such as triggers. If a callback function is not used, set this parameter and the UserContext parameter to NULL.
  • UserContext
    [in] Value passed when the user's callback function is called. The value of this parameter is typically either HWND or a 'this' pointer. If a callback function is not specified, set this parameter and the StatusCallbackProc parameter to NULL..
  • hErrorBlob
    [out] Handle to an error BLOB that contains additional error information.

Return Values

If the 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 IStats::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 IStats::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 might be generated by the IStats::Connect or IStats::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 IStats::Configure call.
NMERR_BLOB_STRING_INVALID The string is not null-terminated. This error is generated by the IStats::Configure call.
NMERR_ILLEGAL_TRIGGER The trigger portion of the input BLOB is corrupt. This error is generated by the IStats::Configure call.
NMERR_INVALID_BLOB The object specified in hInputBlob is not a BLOB. This error is generated by the IStats::Configure call.
NMERR_NO_DEFAULT_CAPTURE_DIRECTORY The default capture directory was not set in the registry. To set the capture directory, use the following path.
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\nm\Parameters\CapturePath
NMERR_OUT_OF_MEMORY The memory required to perform this operation was unavailable. This error is generated by the IStats::Configure call.
NMERR_TIMEOUT The request has timed out. This error is generated by the IStats::Configure call.
NMERR_UPLEVEL_BLOB The version number of the BLOB specified in hInputBlob is incorrect. This error is generated by the IStats::Configure call.

Remarks

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

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

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

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

For information about See
Obtaining the input BLOB that represents a network interface card 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

IStats::Configure, IStats::Disconnect, Network Monitor BLOBS