How to Send a Data Object to the OBEX Server (Windows Embedded CE 6.0)


To copy a file to the OBEX server, send a data object to the server by using the IObexDevice::Put method. The request can contain the Name and Length headers, however, if the target device is so simple that it accepts only one object, the headers may be omitted. If the server is a desktop computer, personal digital assistant (PDA), or any other general-purpose device, headers are highly recommended.

You have declared pointers to the following interfaces:

Step Topic

1. Enable the client to discover an OBEX device by using IConnectionPointContainer and IObexSink:IUnknown interfaces.

Discovering OBEX Devices

2. Retrieve the IObexDevice reference.


3. Call the appropriate method of the IHeaderCollection interface to add a header.


4. Call the IObexDevice::Connect method on the IObexDevice reference to connect to an OBEX server.

Connecting to an OBEX Server

5. Call Put to send the data object to the server. This method returns destination pointer to the IStream interface, which is used to write the data.

Implementing the Put Operation

Headers to Use with Put Operations

6. Call IStream::Write to write into the stream.

To verify that the Put operation has completed, call IStream::Commit before you close the operation.

Use of Streams

7. Close the connection to the OBEX server by calling the IObexDevice::Disconnect on the IObexDevice reference.

Disconnecting from an OBEX Server

8. Release all interfaces and allocated resources.

  • Call the IObex::Shutdown method to release IObex.
  • Call the standard COM Release method to release all other interfaces.


Community Additions