Discovering available comm ports

From Rxtx

Revision as of 09:09, 30 January 2008 by DarraCzelc (Talk | contribs)
Jump to: navigation, search

keg 911 accessory part porsche turbo treasure hunts remover software free spyware virtual mockup sweet soul sisters ignoratio road map costa rica artist fox sam pafile raft suit kicking horse ski resort golden b.c. florsheim dress shoes lover in paris ost between brother isley sheet database development cinnamon dolce latte truck accident illinois adsl speed test satin bedspread vob files penyalahgunaan kuasa nude photo of hot babes runesca pe.com tarot.com walking in memphis chords tab asian martial arts movies mapcore forum 805 area code split ashly delgrosso wbal hot mom son yu gi oh monster picture front page web hosting michigan plumbing code book a day without a night midnightclub3 child clothing otso otso basic spanish words map of italy railway usa passport sharp lc 20b6u s rose bush cuttings psi ops review ps2 pharmacognosy of chenopodium west coast epson stylus ink cartridges alaska rving martha white wholesale herb auction government il sales telesat.com pn03 cheats tyler hill userdata persistence trapdoor rifles erie county democratic party iraqi alliance lifestyle swinging in america glucose monitor 12 k science standard state jacksonville beach vacation rental hardcore couples fucking anti static floor free anime mp3 download george bush jokes 54th massachusetts regiment authorize.net aim response codes gay sex movie car crash picture activision history channel civil war battle of bullrun pc kentucky state police road conditions accounting in job sacramento alimagik jane leeves real world cast member nude kodak dcs pro 14n lake chateau resort inn chicago il imax navy pier theater vertigo treatment lisa rodgers air balloon fiesta hot hotair kenworth dealer list say i yi yi field trial horse westfield nj real estate cabarrus county nc fantasy fest key west mp3 music show vilnius latter day saint visalia amittyville audio speaker market national no call list sem equipment quick crete girls showing it all car dealer new york university of houston mfa swingers clubs kebon toyota camry recall 33 kilo company hunter x hunter example of employment contract young virgins girls virgin girls hawaiian clip art andrea trent 3 paper buildings london everlast music splenda cookie recipe howard behrens best buy canada life magazine photo archives mild tbi illustration pope benedict xvi atv door rhino yamaha plastic speaker enclosure narwhale whistler accomodation extension listing edit a website using microsoft word snake venomous world buy adderall las vegas aladdin hotel and casino net exam questions residence inn by marriott man movie muscle sex william petersen bump sore tongue appraiser county florida marion property fireplace mantle designs nascar collectable cars ccaonline japanese lantern western maryland trains free iq test for kid shoreview nursing home droit bancaire orion dead sea scrolls mobile radios realtor in anderson sc ship loading software magicgate drivers map of chesapeake bay antler tables what the peeper saw friendswood real estate chevrolet minnesota wabasso field position soccer mile search select simi valley hunter douglas blinds plant cuttings 3 month wall calendar godzilla blue oyster cult yugioh duelists of the roses cheat codes indian film actor arbors kara davis movies man michael oliver picture platypus star pictures of scabies infection creative mp3 player biography bobby darin vegas rachel carson wildlife pages templates mac elegant flower girl dresses luxury apartments tucson arizona remote control robot movie skin african american modern bedding ben hogan hp reset ink level runescape accounts florida failure to diagnose lawyers private magazine indian models my space astronomy software mac union bank virginia repeating terminating decimals 2000 gmc jimmy parts chalet location sports complete ebusiness solutions bonus cash casino get online sttng a final unity archaeological mysteries inventory sticker oklahoma outdoor wedding kathy schrock moon sighting islam glass danse italian dictionary normal troponin level separation agreement little rascals shi tzu sawmill ski baby portrait professional old english bulldog puppy for sale sitemap partition magic error 48 foodchannel.com advent child fantasy final movie part baby vagina close continetal airlines bigass southall travels in uk assemble product work from home part school suzuki violin violin sign holders alltheweb video search angelpotion video codecs maxiyoung http soccer pictures import girls wallpaper adult excalibur video lathe guards archive safety video volvo 4 color newsletters my next door neighbor abilene movie texas theater link motorcycle scooter small angelina ballerina videos vintage trailer joint biological point detection system jbpds employee review form arabian night movie animated guide movie open lips ny jets wallpapers adam eve lampoons movie national motor driven timer air filter gas oil water alfee movie efficient britney spears topless drunk mom columbine high picture school shooting cargadores vehiculares para celulares hermione granger xxx checkers auto roadhouse blues original he man medieval times toronto picture cable internet steal circus tent sale insect bite appearance online casino business sitemap queen bee gardens jealousy amethyst crystal home selling a home in scottsdale link sweeping machine add production site video home austrian airlines by fergalicious fergie lyric 1997 ford mustang specs web black like me avi codec video web amateur film movie pornographic teenage natural cures usps palos heights illinois zip code employee give self service state sand box antonio sabato jr movies aol free music video watch 6 bestshack.info showers.html taking teen puggle puppy anal anal ass butthole d.p double double double dp fuck fuck penetration confidentiality agreement activation cell code lg phone programming verizon adult japanese video on demand addicted movie adult free movie rated x protective apparel super mario toys jpmorgan david jewelry replica yurman orange free text messages link norval morrisseau take everything left from me raphael saadiq nelson mandela biography guide local movie theater site eight hundred go adult live web video chat download ringtones web basketball man ncaa tournament bench plan wood work link school bullying prevention pbs kid domain o2 mobile phone teen girl masturbates cherry monroe pet birds nascar 2005 a farewell to arms movie chicago tribune home static control products thirfty car rental puppydog surveyor job descriptions marriage bed forum sitemap usb oscilloscope sitemap kellys kids childrens clothing avi convert dvd movie mold allergy allergies asthma magicien discount books link acts of worship the movie rebecca email marketing campaign sitemap live video chat room adult movie post sex telugu boothu kathalu mcafee virus scan www fast cars and freedom lyrics gooseneck trailers wallpaper dn angel dandelion adidas sale sneaker port of seattle police department peter coppola hair san diego, california audio reliable video 310 566 1063 vh2 online tarot card reading anal first movie painful sex time video family dentistry park rapids www avi ts video asian nurse movies add production url video credit reporting agencies consumer report refrigerator web cam chat dodd darin audie murphy movie play poker jennifer love hewitt wallpaper cool halloween costume atomicbomb video acne treatment mercedes maybach cell katana phone sprint used domain web unforgiven 2003 results free swingers the lifestyle lift procedure conversion chart www buy melatonin natural order source sublingual equipment nation rent rental sterling silver wholesale body jewelry meaning peach rose signs and symptoms of leukemia in children colon cancer symptoms sitemap sbs internet roulette domain banana muffin recipe discount drug plan prescription fighting fish adult adultdvdonlinestore.net gay hot movie sex video hawaii discount realty abi download free titmus video alta dome gay gay movie movie post website 50 cent song award video drivers embroidered hat and cap dental postcards xavier naidoo songtexte mmmm url lorabel rey dronrac This code snippet shows how to retrieve the available comms ports on your computer. A CommPort is available if it is not being used by another application. Note the difference between the two examples is that the version for JDK 5.0 up uses generics:

JDK <= 1.4

   /**
     * @return    A HashSet containing the CommPortIdentifier for all serial ports that are not currently being used.
     */
    public static HashSet getAvailableSerialPorts() {
        HashSet h = new HashSet();
        Enumeration thePorts = CommPortIdentifier.getPortIdentifiers();
        while (thePorts.hasMoreElements()) {
            CommPortIdentifier com = (CommPortIdentifier) thePorts.nextElement();
            switch (com.getPortType()) {
            case CommPortIdentifier.PORT_SERIAL:
                try {
                    CommPort thePort = com.open("CommUtil", 50);
                    thePort.close();
                    h.add(com);
                } catch (PortInUseException e) {
                    System.out.println("Port, "  + com.getName() +  ", is in use.");
                } catch (Exception e) {
                    System.err.println("Failed to open port " + com.getName());
                    e.printStackTrace();
                }
            }
        }
        return h;
    }

JDK >= 5.0

   /**
     * @return    A HashSet containing the CommPortIdentifier for all serial ports that are not currently being used.
     */
    public static HashSet<CommPortIdentifier> getAvailableSerialPorts() {
        HashSet<CommPortIdentifier> h = new HashSet<CommPortIdentifier>();
        Enumeration thePorts = CommPortIdentifier.getPortIdentifiers();
        while (thePorts.hasMoreElements()) {
            CommPortIdentifier com = (CommPortIdentifier) thePorts.nextElement();
            switch (com.getPortType()) {
            case CommPortIdentifier.PORT_SERIAL:
                try {
                    CommPort thePort = com.open("CommUtil", 50);
                    thePort.close();
                    h.add(com);
                } catch (PortInUseException e) {
                    System.out.println("Port, "  + com.getName()  + ", is in use.");
                } catch (Exception e) {
                    System.err.println("Failed to open port " + com.getName());
                    e.printStackTrace();
                }
            }
        }
        return h;
    }
Personal tools