Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

Connectrequests are optional. If a Connectrequest is not issued before a IObexDevice::Getor IObexDevice::Putcommand, a default packet size of 255 bytes is assumed.

To send a Connectrequest to the server, pass the headers in the IObexDevice::Connectmethod. Response, sent by the server, includes headers in the property bag that is returned from IObexDevice::Connect.

The following code example is an excerpt from the sample function, Connect, that is defined in filebrowser.h.

For Windows Mobile, the filebroswer.h file is at < Adaptation Kit directory>\Public\Servers\SDK\Samples\OBEX\OBEXTOOL.

This example shows how to add a target header and then connect to an OBEX Server

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.

Copy Code
//Declare interface pointers.
IObexDevice *pObexDevice;
IObex *pObex;
IHeaderCollection *pHeaderCollection = 0;
//Get a Header Collection.
HRESULT hr = CoCreateInstance(CLSID_Obex, 
				NULL, 
				CLSCTX_INPROC_SERVER, 
				IID_Obex, 
				(void**)&pObex);
...//A call to notify returns the property bag in the 
pUnk1 parameter
...//Discover Obex devices
);
HRESULT hr = CoCreateInstance(CLSID_HeaderCollection, 
				NULL, 
				CLSCTX_INPROC_SERVER, 
				IID_HeaderCollection, 
				(void**)&pHeaderCollection);
pHeaderCollection->AddTarget(sizeof(CLSID_FileExchange_NetOrder),
					(UCHAR *)&CLSID_FileExchange_NetOrder;
//Connect to the OBEX server.
hr = BindToDevice(pBag, pObexDevice);
hr = pObexDevice->Connect(NULL, 0, pHeaderCollection);

The packet length varies depending on included headers.

For more information, see the OBEX specification at this Official IrDA Web site .

The following optional headers can be used in a Connectrequest:

  • Targetis used to specify a service. If a target is not specified, the default inbox service is assumed.

  • Authenticate Challengeis used by the client when authenticating with a server.

  • Authenticate Responseis sent by the client when responding to a server challenge.

The OBEX version is 1.2 and the flags are always set to 0.

The maximum packet length varies depending upon the packet's configuration.

The following optional headers can be used in a Connectresponse:

  • Whocontains the same information specified in the request target header.

  • Authenticate Challengeis sent by the server when a client is authenticating.

  • Authenticate Responseis sent by the server to indicate a successful challenge/response.

See Also

500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@systemmanager.forsenergy.ru to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.