How to Send a Data Object to the OBEX Server

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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.

Hardware and Software Assumptions

You have declared pointers to the following interfaces:

Steps

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.

None.

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

None.

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.

Headers to Use with Put Operations

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

> [!NOTE] > 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.

None.

See Also

Tasks

How to Request a Data Object from the OBEX Server

Concepts

Client Support