Implementing the PUT Operation

A client-side push is the most common application of OBEX. It enables clients to transfer files to a server. A common scenario for this feature would be a user transferring a calendar schedule to a PDA.

To implement this feature, the following steps are required:

  1. Create an instance of the following interfaces:
  2. Initialize the IObex interface by calling the IObex::Initialize method.
  3. To obtain a list of available devices, call the IObex::EnumDevices method. Alternatively, you can also call the IObexSink::Notify method to obtain a list of available Bluetooth devices.
  4. Using the IHeaderCollection interface, build the collection of headers that you would like to pass into the IObexDevice::Connect method.
  5. Using the information from IObex::EnumDevices, connect to the desired device with the IOBexDevice::Connect method.
  6. Using the IHeaderCollection interface, build the collection of headers that you would like to pass into the IObexDevice::Put method. This collection is used to describe the object you are pushing.
  7. Call the IObexDevice::Put method. Include the collection of headers that describe the object.
  8. The IObexDevice::Put method returns a stream. Use the IStream interface to write the stream to the server.
  9. When finished, release the stream.
  10. To release the connection, call the IObexDevice::Disconnect method.
  11. To release the IObex interface and allocated resources, call the IObex::Shutdown method.
  12. Release all other interfaces.

See Also

OBEX Samples | Implementing the GET Operation

 Last updated on Friday, April 09, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.