Java Reference
In-Depth Information
Caution Do not call getResponseCode() unless you are finished with the stream you have obtained
from the operation. Calling getResponseCode() will implicitly close the stream and signal to the server that
the operation is completed. No further IO operations will be possible on the stream once getResponseCode()
is called.
The abort() method may be used to abort a GET or PUT operation. It will close the operation's
stream implicitly.
void abort();
Obtaining OBEX Client and Server Connections
When creating clients using OBEX over IrDA, the connection URL string provided to GCF's
Connector.open() contains all the instructions necessary to work with the communications
stack. The underlying implementation will parse the connection string for the instruction.
The general format is as shown here:
"irdaobex://{target};{parameters}"
If {target} begins with discover , the IrDA stack will perform discovery for accessible IrDA
devices. The {target} of server connections always begins with localhost . A very useful
parameter available for OBEX/IrDA is the ias parameter. The ias parameter is the string-based
IAS class name used for server identification.
For example, a server application called DatingService can use the following connection
string:
"irdaobex://localhost;ias=DatingService"
An OBEX client wishing to discover and connect to this service can simply use this connection
string:
"irdaobex://discover;ias=DatingService"
The OBEX API extends the GCF with SessionNotifier for creating OBEX server connections.
OBEX server code can wait for incoming client OBEX connections, blocking on an
acceptAndOpen() call on a SessionNotifier .
See JSR 82 and documentation of your OBEX over IrDA implementation for more details
on the available target and parameter values.
An OBEX Dating Service
Reusing the application logic from the Bluetooth dating service example earlier, this second
example implements the same dating service using OBEX over infrared.
To try out this example, perform the following steps:
1.
Using KToolbar, create a project called OBEXMIDlet.
Copy the source files to the src directory of OBEXMIDlet.
2.
 
Search WWH ::




Custom Search