## EXPORT_SPEC int UpnpSubscribeAsync

## ( IN UpnpClient_Handle Hnd,
IN const char* PublisherUrl,
IN int TimeOut,
IN Upnp_FunPtr Fun,
IN const void* Cookie )

> UpnpSubscribeAsync performs the same operation as UpnpSubscribe, but returns immediately and calls the registered callback function when the operation is complete.

## Documentation

> UpnpSubscribeAsync performs the same operation as UpnpSubscribe, but returns immediately and calls the registered callback function when the operation is complete.

> Note that many of the error codes for this function are returned in the Upnp_Event_Subscribe structure. In those cases, the function returns `UPNP_E_SUCCESS` and the appropriate error code will be in the Upnp_Event_Subscribe.ErrCode field in the Event structure passed to the callback.

Parameters:
  Hnd - The handle of the control point that is subscribing.
  - PublisherUrl The URL of the service to subscribe to.
  - TimeOut The requested subscription time. Upon return, it contains the actual subscription time returned from the service.
  Fun - Pointer to the callback function for this subscribe request.
  Cookie - A user data value passed to the callback function when invoked.
Returns:
  [int] An integer representing one of the following:
  - `UPNP_E_SUCCESS`: The operation completed successfully.
  - `UPNP_E_INVALID_HANDLE`: The handle is not a valid control point handle.
  - `UPNP_E_INVALID_URL`: The PublisherUrl is not a valid URL.
  - `UPNP_E_INVALID_PARAM`: Either TimeOut or Fun or PublisherUrl is not a valid pointer.
  - `UPNP_E_OUTOF_MEMORY`: Insufficient resources exist to complete this operation.
  - `UPNP_E_NETWORK_ERROR`: A network error occured (returned in the Upnp_Event_Subscribe.ErrCode field as part of the callback).
  - `UPNP_E_SOCKET_WRITE`: An error or timeout occurred writing to a socket (returned in the Upnp_Event_Subscribe.ErrCode field as part of the callback).
  - `UPNP_E_SOCKET_READ`: An error or timeout occurred reading from a socket (returned in the Upnp_Event_Subscribe.ErrCode field as part of the callback).
  - `UPNP_E_SOCKET_BIND`: An error occurred binding the socket (returned in the Upnp_Event_Subscribe.ErrCode field as part of the callback).
  - `UPNP_E_SOCKET_CONNECT`: An error occurred connecting to PublisherUrl (returned in the Upnp_Event_Subscribe.ErrCode field as part of the callback).
  - `UPNP_E_OUTOF_SOCKET`: An error occurred creating the socket (returned in the Upnp_Event_Subscribe.ErrCode field as part of the callback).
  - `UPNP_E_BAD_RESPONSE`: An error occurred in response from the publisher (returned in the Upnp_Event_Subscribe.ErrCode field as part of the callback).
  - `UPNP_E_SUBSCRIBE_UNACCEPTED`: The publisher refused the subscription request (returned in the Upnp_Event_Subscribe.ErrCode field as part of the callback).

Alphabetic index

This page was generated with the help of DOC++.