Sponsored Content
Top Forums Programming PortInUse Exception in SerialDemo Post 302739567 by rkelly on Tuesday 4th of December 2012 11:49:16 AM
Old 12-04-2012
I'm pretty sure it's not the SerialDemo code as I have created a very simple app that does nothing but scroll through the list of ports and attempt to open them.
Here's the code (hand-typed so excuse the typos):

Code:
import javax.comm.*;
import java.util.Enumeration;
public class Main {
  public Main() {
  }
  public static void main(String[] args) {
    try {
      Enumeration portList = CommPortIdentifier.getPortIdentifiers();
      while(portList.hasMoreElements()){
        CommPortIdentifier pi = (CommPortIdentifier)portList.nextElement();
        try {
          SerialPort sp = (SerialPort)pi.open("TEST", 5000);
        } catch(PortInUseException piue) {
          System.out.println("Port In Use");
        }
      }
    } catch(Exception e) {
      System.out.println(e.getMessage());
    }
  }
}


Last edited by Scott; 12-04-2012 at 01:08 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to catch the exception

Dear friends, I am transferring some files to a windows system from Unix m/c thru FTP Script given below. echo "open $host quote USER $userid quote PASS $pwd $verbose $type cd $dir bin put $file close quit"|$ftp... (0 Replies)
Discussion started by: Vijayakumarpc
0 Replies

2. Linux

MMU exception

I hope to post in the right forum, otherwise I apologize for this. if a MMU exception is caused by a process which tries to access to other memory segment (out of its own address space) what the kernel does in this case ? maybe kernel kills the "bad" process ? (2 Replies)
Discussion started by: Puntino
2 Replies

3. Shell Programming and Scripting

Perl Exception - $!,$?,$@

Hi, I am trying to understand the significance of the special variables $!,$@ and $? in perl. I have a code block as follows: eval { Code Segment 1: #authenticating to the remote server $ftpobj -> login($username,$password) or die "Can't login to $remote_host"; ... (12 Replies)
Discussion started by: DILEEP410
12 Replies

4. Shell Programming and Scripting

Exception Handling

Hi, I have written a script to load csv files into a mysql database, however, i would like for the shell script to exit in the event of an error (missing file, load error etc.) - currently if an error is encountered the next statement is processed - This is how i am loading the csv scripts ... (5 Replies)
Discussion started by: bertpereira
5 Replies

5. Shell Programming and Scripting

Exception handling

Sometimes when I try to use curl to upload to an ftp server, I get the message: $curl -T file.wmv ftp.eu.filesonic.com --user user:password curl: (8) Got a 421 ftp-server response when 220 was expected How do I get the script to try again if I get the message curl: (8)? (2 Replies)
Discussion started by: locoroco
2 Replies

6. Programming

Exception Handling C++

Hello All, I have a question ....which I am totally confused about! If I have a fxn foo in a program which returns a logical value. But it has a posssiblity to throw some exception. Now my exception handler returns a value as a string stating why the exception occured. But my... (1 Reply)
Discussion started by: mind@work
1 Replies

7. Solaris

solaris 7 exception

Hi all, An application works well under 2.6 but under 7 it gives TEXT_IO exceptions. (Is_Open, Check_Is_Open, Get_Line procedures). Any idea? Regards (3 Replies)
Discussion started by: endoavour
3 Replies

8. Shell Programming and Scripting

Re: exception using AWK

I have following file: NAME=ora.DG1.svc TYPE=ora.service.type CARDINALITY_ID=1 TARGET=ONLINE STATE=ONLINE NAME=ora.orlene.DG2.svc TYPE=ora.service.type CARDINALITY_ID=1 TARGET=ONLINE STATE=OFFLINE NAME=ora.MN.acfs TYPE=ora.registry.acfs.type TARGET=ONLINE (4 Replies)
Discussion started by: rcc50886
4 Replies

9. SCO

Issue using SCO java SerialDemo

I recently installed the Java Communications API (v2.0Aa) on SCO and I'm having some issues running the SerialDemo application that comes with it. I can open a connection and send text from SCO to a toy windows app I wrote - that works fine. However, when I try and close the connection, I get... (2 Replies)
Discussion started by: jdsnatl
2 Replies

10. Shell Programming and Scripting

Monitor logs for exception and if exception come then sent an email

Hi Folks, please advise , I have logs generated on unix machine at location /ops/opt/aaa/bvg.log , now sometimes there come exception in these logs also, so I want to write such a script such that it should continuously monitor these logs and whenever any exception comes that is it try to find... (3 Replies)
Discussion started by: tuntun27272727
3 Replies
REFLECTIONCLASS(3)							 1							REFLECTIONCLASS(3)

The ReflectionClass class

INTRODUCTION
The ReflectionClass class reports information about a class. CLASS SYNOPSIS
ReflectionClass ReflectionClassReflector Constants o const integer$ReflectionClass::IS_IMPLICIT_ABSTRACT16 o const integer$ReflectionClass::IS_EXPLICIT_ABSTRACT32 o const integer$ReflectionClass::IS_FINAL64 Properties o public$name Methods o public ReflectionClass::__construct (mixed $argument) o publicstatic string ReflectionClass::export (mixed $argument, [bool $return = false]) o public mixed ReflectionClass::getConstant (string $name) o public array ReflectionClass::getConstants (void ) o public ReflectionMethod ReflectionClass::getConstructor (void ) o public array ReflectionClass::getDefaultProperties (void ) o public string ReflectionClass::getDocComment (void ) o public int ReflectionClass::getEndLine (void ) o public ReflectionExtension ReflectionClass::getExtension (void ) o public string ReflectionClass::getExtensionName (void ) o public string ReflectionClass::getFileName (void ) o public array ReflectionClass::getInterfaceNames (void ) o public array ReflectionClass::getInterfaces (void ) o public ReflectionMethod ReflectionClass::getMethod (string $name) o public array ReflectionClass::getMethods ([int $filter]) o public int ReflectionClass::getModifiers (void ) o public string ReflectionClass::getName (void ) o public string ReflectionClass::getNamespaceName (void ) o public object ReflectionClass::getParentClass (void ) o public array ReflectionClass::getProperties ([int $filter]) o public ReflectionProperty ReflectionClass::getProperty (string $name) o public string ReflectionClass::getShortName (void ) o public int ReflectionClass::getStartLine (void ) o public array ReflectionClass::getStaticProperties (void ) o public mixed ReflectionClass::getStaticPropertyValue (string $name, [mixed &$def_value]) o public array ReflectionClass::getTraitAliases (void ) o public array ReflectionClass::getTraitNames (void ) o public array ReflectionClass::getTraits (void ) o public bool ReflectionClass::hasConstant (string $name) o public bool ReflectionClass::hasMethod (string $name) o public bool ReflectionClass::hasProperty (string $name) o public bool ReflectionClass::implementsInterface (string $interface) o public bool ReflectionClass::inNamespace (void ) o public bool ReflectionClass::isAbstract (void ) o public bool ReflectionClass::isCloneable (void ) o public bool ReflectionClass::isFinal (void ) o public bool ReflectionClass::isInstance (object $object) o public bool ReflectionClass::isInstantiable (void ) o public bool ReflectionClass::isInterface (void ) o public bool ReflectionClass::isInternal (void ) o public bool ReflectionClass::isIterateable (void ) o public bool ReflectionClass::isSubclassOf (string $class) o public bool ReflectionClass::isTrait (void ) o public bool ReflectionClass::isUserDefined (void ) o public object ReflectionClass::newInstance (mixed $args, [mixed $...]) o public object ReflectionClass::newInstanceArgs ([array $args]) o public object ReflectionClass::newInstanceWithoutConstructor (void ) o public void ReflectionClass::setStaticPropertyValue (string $name, string $value) o public string ReflectionClass::__toString (void ) PROPERTIES
o $name - Name of the class. Read-only, throws ReflectionException in attempt to write. PREDEFINED CONSTANTS
REFLECTIONCLASS MODIFIERS
o ReflectionClass::IS_IMPLICIT_ABSTRACT - Indicates class that is abstract because it has some abstract methods. o ReflectionClass::IS_EXPLICIT_ABSTRACT - Indicates class that is abstract because of its definition. o ReflectionClass::IS_FINAL - Indicates final class. PHP Documentation Group REFLECTIONCLASS(3)
All times are GMT -4. The time now is 02:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy