Partager via


ICcService::Connect (Windows CE 5.0)

Send Feedback

This method establishes a connection for service between host and device.

HRESULT Connect(  DWORDdwTimeout,VARIANT_BOOLbAsync,DWORD*pdwCookieId);

Parameters

  • dwTimeout
    [in] Timeout specified in milliseconds for the connection attempt to wait before returning to the client.

  • bAsync
    [in] Indicator for asynchronous call.

    If this is set to VARIANT_TRUE, the method returns immediately. In that case, clients can get status on the connect progress through the callback function and dwTimeout is ignored.

  • pdwCookieId
    [out, retval] A valid cookie that identifies the method call. Callers can use this cookie in calls to ICcService::Abort to cancel a pending asynchronous call.

Return Values

The following table shows return values for this method.

Value Description
S_OK Indicates success.
E_PENDING Indicates that a connection could not be established within the given dwTimeout.

This status code is also returned if a connection request is pending on this same service.

Users can try again with a different timeout.

E_FAIL Indicates failure.

Remarks

If this call is successful, the service should set its internal state to the SERVICE_INIT_CONNECT value.

If a client calls this method multiple times and the service is connected, the method call translates to a no-op.

If clients pass in VARIANT_TRUE for the second parameter, the timeout parameter is ignored and the call returns immediately. In this case the service state is set to SERVICE_INIT_CONNECT_PENDING.

Clients can get the status of this request through ICcServiceCB. This call returns immediately if the service is initialized and an outstanding connection request is pending.

Requirements

OS Version: Windows CE 5.0 and later.
Header: CcService.h.
Link Library: none.

See Also

Core Connectivity Interfaces

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.