Aborting a Request (Windows CE 5.0)

Send Feedback

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 is an excerpt from the sample function, FetchFile, that is defined in filebrowser.h in %_WINCEROOT%\Public\Servers\SDK\Samples\OBEX\OBEXTOOL. This example shows how to abort a request.

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

Client Support

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.