• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

serial connection w/ palm

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> 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
 
chris chayka
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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??
 
We don't have time to be charming! Quick, read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic