Share via


Aborting a Request

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

The IObexDevice::Abort method is used to terminate a multi-packet IObexDevice::Put or IObexDevice::Get request. Abort passes the service header to the server.

The following code example, which shows how to abort a request, is an excerpt from the sample function, FetchFile, that is defined in filebrowser.h.

Note

To make the following code example easier to read, error checking is not included. This code example should not be used in a release configuration unless it has been modified to include secure error handling.

IHeaderCollection *pAbortHeaderCollection = NULL;
IObexDevice *pObexDevice = NULL;
If(SUCCEEDED(CoCreateInstance(CLSID_HeaderCollection, 
                   NULL, 
                   CLSCTX_INPROC_SERVER, 
                   IID_IHeaderCollection,
                   (void**)&pAbortHeaderCollection)) 
                   && NULL !=pAbortHeaderCollection)
{
  pObexDevice->Abort(pAbortHeaderCollection);
  pAbortHeaderCollection->Release();
}

Because additional headers are not used with the Abort request packet, the packet length should always be three.

The Abort request and response each fit in one OBEX packet, and have the final bit set.

If the Abort request is successful, the response code is 0xA0 and the server is resynchronized with the client. If any other response is returned, the client should disconnect.

See Also

Concepts

Client Support