Java Reference
In-Depth Information
public void run() {
DataOutputStream dos = null;
Operation op = null;
ClientSession ses = null;
int code = 0;
HeaderSet resp = null;
HeaderSet hdrs = null;
while( !mEndNow) {
ses = null;
dos = null;
op = null;
try {
ses = (ClientSession) Connector.open(url);
} catch (IOException ex) {
// Discovery fails, sleep for a while and try again
try {
Thread.sleep(3000l);
} catch (Exception e) {}
continue;
}
try {
resp = ses.connect(null);
code = resp.getResponseCode();
if (code != ResponseCodes.OBEX_HTTP_OK) {
throw new IOException("OBEX connect operation failed");
}
hdrs = ses.createHeaderSet();
op = ses.put(hdrs);
dos = null;
dos = op.openDataOutputStream();
if (dos != null) {
dos.writeUTF(mPref);
dos.writeUTF(mHeight);
dos.writeUTF(mContact);
dos.flush();
dos.close();
code = op.getResponseCode();
// System.out.println("before os close");
if (code != ResponseCodes.OBEX_HTTP_OK) {
throw new IOException("OBEX failure after put operations");
}
Search WWH ::




Custom Search