How to Send a Data Object to the OBEX Server
A version of this page is also available for
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:
- IObex:IUnknown. Used for the OBEX services.
- IHeaderCollection:IUnknown. Used to create header collections.
- IObexDevice:IUnknown. Used to execute common operations.
- IStream. Used to manage data streams between devices.
Steps
Step | Topic |
---|---|
1. Enable the client to discover an OBEX device by using IConnectionPointContainer and IObexSink:IUnknown interfaces. |
|
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. |
|
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. |
|
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. |
|
7. Close the connection to the OBEX server by calling the IObexDevice::Disconnect on the IObexDevice reference. |
|
8. Release all interfaces and allocated resources.
|
None. |
See Also
Tasks
How to Request a Data Object from the OBEX Server