Forums Register Login

serial connection w/ palm

+Pie Number of slices to send: Send
Hi, I am having a problem closing the serial connection with the palm. I am using cldc 1.02 with dataInputStream.
public void
closeStream()
{
try
{
dis = null;
dis.close();
}
catch(Exception iox)
{System.out.println("io exception at close stream");}
}
The exception above is caught, a thread doing a dis.readByte() is unlocked (i assume) and the program terminates. However, when I try and hotSync, I get an error message stating that the serial port is in use by another application. Am I missing something when closing the dataInputStream? If I do not set dis to null before closing, the program hangs due to the blocked thread.
Thanks very much in advance,
chris chayka
cchayka@elantech-inc.com
+Pie Number of slices to send: Send
> dis = null;
> dis.close();
Don't you want those the other way round, maybe?
Closing a null won't do much...
------------------
Richard Taylor
Author of Professional Java Mobile Programming
+Pie Number of slices to send: Send
this is true, however, if I reorder the close and null, the program hangs until a byte of data comes across the serial line to release a blocked thread. If the thread executing dis.readByte() does not receive anything, it waits and waits. Is there a way I can kill it or throw some kind of exception after closing the data input stream that will cause an exit?
Thanks again,
chris chayka
+Pie Number of slices to send: Send
Hello everybody,
I got a problem writing to a palm serial port. The code is as follows:
Connector.open("comm:0;baudrate=9600");
The program compiles fine (using the Wireless toolkit). I converted it to a .prc using the MIDP for Palm but when I try to run it on a palm, the following exception is thrown:
unsupported protocol comm
I have tried replacing comm with comm. and com and neither of these works. Anyone got any ideas? Or is comm not supported yet in MIDP for palm??
It looks like it's time for me to write you a reality check! Or maybe a tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 972 times.
Similar Threads
Reading Data from a file and extracting the data
Using interrupt() to stop a thread
downloadWebpage() problem
Dynamically reading a file
Reading file from memory card
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 02:07:47.