Associating a comm port with a TS test socket

Hello,
In order to run several test platforms on one machine (parallel model), I must be able to associate each test socket with a unique serial port. Each hardware platform has it's own serial connection which is built in Labview. So my question is, "how can I use a single test sequence calling LV VIs where each test socket must use a different comm port?"
Thank you for helping,
Adam

How dynamic is the com port configurations? Will some testers only differ in the number of ports? If that's the case, then you'll also need to dynamically change how many sockets you're testing. This could be done, probably in a sequence file load callback and with the LabVIEW function VISA Find Resource. Searching for all ASRL resources will return a count and their names. You could populate a station global string array with the names. Right now, I have a fixed count of resources so I just populate a main sequence local variable with all of the possible names. I assign the resource name for the VI as Locals.VISAResource and in a pre-expression for the VI, Locals.VISAResource = Locals.AllVISAResources[RunState.TestSockets.MyIndex]

Similar Messages

  • Enumerating available comm ports with friendly names

    Hello
    I 'm using a Virtual com port.
    In order to simplify the setting of the COM port I would like to get back the associated name of the COM port, to set automatically the right COM port.
    for the moment I use this piece of code
    public void listePortsDispo()
         Win32Driver w32Driver= new Win32Driver();
         w32Driver.initialize();
    Enumeration portList=CommPortIdentifier.getPortIdentifiers();
    CommPortIdentifier portId;
    if (portList==null)
    System.err.println("No COM port detected");
    javax.swing.JOptionPane.showMessageDialog(null,"No COM port detected");
    return;
    while (portList.hasMoreElements()){
         portId=(CommPortIdentifier)portList.nextElement();
         System.out.println("* "+portId.getName());
    } // while
    } But it returns something like that:
    * COM1
    * COM5
    * COM6
    * COM7
    and I don't really know which is the right COM port I have to use.
    I would like to have something like that:
    COM1: = Communications Port (COM1)
    COM5: = NI Serial Port (Com5)
    COM6: = NI Serial Port (Com6)
    COM7: = USB Serial Port (COM7)
    Like this I can identify clearly which PORT I have to use for my application.
    If someone can help me it would be great.
    Many thanks by advance
    Best Regards

    Perhaps my own lack of understanding. I was under the impression that RXTX was an implementation of the sun API; and that since I'm writing my own implementation, all I needed was the sun framework.
    Perhaps I need to look at RXTX more closely.

  • Attach Forms With Comm Port in Oracle Forms

    I am trying to make connection of Oracle forms Builder with my device using comm port but i dnt know the complete procedure to attach the comm with oracle forms also i have no idea to convert asquii data to normal form.Please any one help me to attach comm port with my oracle forms and also convert asqui code which is showing on hyper terminal into normal data.Also I am using oracle forms 6i

    Make a java component (PJC) and use a rxtx library (http://rxtx.qbang.org/wiki/index.php/Examples) ...
    I have made a PJC to use a RS232 port from oracle forms for Hypercom POS terminal..
    Here is my code (in short i will post a component on PJC site (here I can't post a complete code because of 30000 char limit ;) )..
    If you look in method "public void init(IHandler handler) " I make a download of rxtxSerial.dll from my forms server and then I call System.loadLibrary("rxtxSerial");"
    In other way you must put the dll in windows/system32 path.. This dll is native library for rs232 communication.
    If you look at the method "public void doTransaction" you can see the initialization of comm port...
    With inputStream and OutputStream you read and write datas to/from your rs232 port..
    p.s: the code is not complete but you can see how I made the rs232 communication (also the code is not final ;) )
    ====================================================
    public class PosTerminalPjc extends VBean {
         private static final long serialVersionUID = -8814623494538014849L;
         Properties res = new Properties();
         SerialPort serialPort;
         OutputStream os;
         InputStream is;
         CommPortIdentifier portId;
         Enumeration portList;
         IHandler mHandler;
      Random randomGenerator = new Random();
            char STX = 2;
         char ETX = 3;
         char EOT = 4;
         char ACK = 6;
         char NAK = 15;
         char FS = 28;
         private static final ID COMPORT         = ID.registerProperty("COMPORT"); // serial port (COM1,COM2,COM3,...)
         private static final ID AMOUNT          = ID.registerProperty("AMOUNT"); // amount of the transaction (12)
         private static final ID TRANSACTIONTYPE = ID.registerProperty("TRANSACTIONTYPE"); // SALE, REFUND
      private static final ID EXECUTE         = ID.registerProperty("EXECUTE"); // invoke doTransaction();
      //Output parameters to form
      private static final ID TRANSACTIONPROCESSED  = ID.registerProperty("TRANSACTIONPROCESSED");
      private static final ID TRANSACTIONFLAG       = ID.registerProperty("TRANSACTIONFLAG");
      private static final ID TRANSACTIONNUMBER     = ID.registerProperty("TRANSACTIONNUMBER");
      private static final ID BATCHNUMBER           = ID.registerProperty("BATCHNUMBER");
      private static final ID TRANSACTIONDATE       = ID.registerProperty("TRANSACTIONDATE");
      private static final ID TRANSACTIONTIME       = ID.registerProperty("TRANSACTIONTIME");
      private static final ID TRANSACTIONAMOUNT     = ID.registerProperty("TRANSACTIONAMOUNT");
      private static final ID CARDDATASOURCE        = ID.registerProperty("CARDDATASOURCE");
      private static final ID NUMBERCUSTOMERCARD    = ID.registerProperty("NUMBERCUSTOMERCARD");
      private static final ID EXPIRATIONDATE        = ID.registerProperty("EXPIRATIONDATE");
      private static final ID TERMINALID            = ID.registerProperty("TERMINALID");
      private static final ID MERCHANTID            = ID.registerProperty("MERCHANTID");
      private static final ID COMPANYNAME           = ID.registerProperty("COMPANYNAME");
      private static final ID SEQUENTIALNUMBER      = ID.registerProperty("SEQUENTIALNUMBER");
      private static final ID ERRORDESC             = ID.registerProperty("ERRORDESC");
         //Events
      private static final ID EVT_OK  = ID.registerProperty("EVT_OK"); //custom event if all ok
      private static final ID EVT_ERR = ID.registerProperty("EVT_ERR"); //custom event if error occured
      // state machine variables
         long l_timeout;
         long l_wait_for = 5000; // pos terminal wait for command (5 seconds)
         long l_wait_for_transaction = 62000 * 2; // pos terminal timeout
         long l_second = 1000; // one second
         byte b_retry = 0;
         String dataValue = "";
      byte[] readBuffer = new byte[2000]; //2000 bytes buffer to read rs232 stream
         String comPort = ""; // local variable to store com port name
                                       // (COM1,COM2,...)
         String transactionType = "SALE"; // type of transaction to be executed (SALE
                                                      // or REFUND) default SALE
         String amount = "0"; // default amount value is set to 0
         //output paramerers
      String transactionProcessed = "";
      String transactionFlag = "";
      String transactionNumber = "";
      String batchNumber = "";
      String transactionDate = "";
      String transactionTime = "";
      String transactionAmount = "";
      String cardDataSource = "";
      String numberCustomerCard = "";
      String expirationDate = "";
      String terminalId = "";
      String merchandId = "";
      String companyName = "";
      String sequentialNumber ="";
      String errorDescription;
        public PosTerminalPjc() {
              super();
              System.out.println("============================");
              System.out.println("== State machine POS v1.0 ==");
              System.out.println("== Peter Valencic (c)     ==");
              System.out.println("== 03.04.2012             ==");
              System.out.println("============================");
        System.out.println("java.library.path: "+System.getProperty("java.library.path"));
              try {
                   res.load(this.getClass().getResourceAsStream("/res/language.properties")); // load language file
              } catch (Exception ex) {
                   System.err.println("Err loading language.properties file: "
                             + ex.toString());
      public void init(IHandler handler)
        super.init(handler);
        this.mHandler = handler;
        System.out.println("init handler ok");
        System.out.println("code base: "+handler.getCodeBase());
        //load dll from codeBase URL
        try
          String mylibName = "rxtxSerial.dll";
          String URLpath = "http://dekani:7777/forms/java/";
          System.out.println("URL: "+ URLpath + mylibName);
          URL libUrl = new URL(URLpath+mylibName);
          System.out.println("libUrlgetFile: " + libUrl.getFile());
          File file = new File(mylibName);
          System.out.println(file);
          if (!file.exists())
          file.createNewFile();
          URLConnection urlc = libUrl.openConnection();
          InputStream in = urlc.getInputStream();
          FileOutputStream out = new FileOutputStream(file);
          byte[] buffer = new byte[1048];
          int read;
          while ((read = in.read(buffer)) != -1){
             out.write(buffer, 0, read); // write
            out.close();
            in.close();
            System.loadLibrary("rxtxSerial");
        catch(Exception exc)
          System.err.println("Exception SystemLoadLibrary: " + exc.toString());
          this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_lib"));
      private void doTransaction() throws Exception {
        String sequentialNumber = ""+getRandomInteger(1000,9000,randomGenerator);
              String phase = null; // initial null value for state machine phase
              long l_ack_timeout = 0; //initial value for acknowledge timeout
              // com port check
              if (getComPort().trim().equalsIgnoreCase("")) {
                   this.showError(res.getProperty("s_dlg_err_title"),
                             res.getProperty("s_com_invalid"));
              if (this.mHandler != null)
                                CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                                this.setErrorDescription(res.getProperty("s_com_invalid"));
                                dispatchCustomEvent(ce);
                   return;
              // transaction type chek
              System.out.println(this.getTransactionType());
              if (!getTransactionType().equalsIgnoreCase("REFUND")
                        & !getTransactionType().equalsIgnoreCase("SALE")
            & !getTransactionType().equalsIgnoreCase("TICKET")
            & !getTransactionType().equalsIgnoreCase("VOID")
                   this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_tran_invalid_type"));
          if (this.mHandler != null)
                                CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                                this.setErrorDescription(res.getProperty("s_tran_invalid_type"));
                                dispatchCustomEvent(ce);
                   return;
              portList = portId.getPortIdentifiers();
              while (portList.hasMoreElements()) {
                   portId = (CommPortIdentifier) portList.nextElement();
          System.out.println(portId.getName());
                   if (portId.getName().equalsIgnoreCase(this.getComPort())) {
                        System.out.println("Port is used : "
                                  + portId.isCurrentlyOwned());
                        serialPort = (SerialPort) portId.open("ComDriver", 2000);
                        serialPort.setSerialPortParams(9600, SerialPort.DATABITS_7,
                                  SerialPort.STOPBITS_1, SerialPort.PARITY_EVEN);
                        serialPort.notifyOnDataAvailable(true);
                        serialPort.notifyOnOutputEmpty(true);
                        os = serialPort.getOutputStream();
                        is = serialPort.getInputStream();
                        break;
              if (portId == null) {
              this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_com_not_found"));
          if (this.mHandler != null)
                                CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                                this.setErrorDescription(res.getProperty("s_com_not_found"));
                                dispatchCustomEvent(ce);
                   return;
        else if (portId.getName().equalsIgnoreCase(this.getComPort()) == false)
                  this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_com_not_found"));
          if (this.mHandler != null)
                                CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                                this.setErrorDescription(res.getProperty("s_com_not_found"));
                                dispatchCustomEvent(ce);
          return;
              // state machine infinite loop
              while (true)
                   // SEND DATA TO POS TERMINAL
                   if (phase == null)
                        System.out.println("start phase");
                        byte[] req = null;
                        //verify transaction type to be SALE or REFUND
                        //if REFUND then transaction number must be specified
                        if (getTransactionType().equalsIgnoreCase("SALE")) {
                             System.out.println("--> SALE send message to the pos terminal");
                             System.out.println("--> amount: " + amount);
                             req = protocolStream("000000"+sequentialNumber+"01100" + FS + amount + FS
                                       + FS + "+0" + FS + "978" + FS + FS + FS + FS + FS
                                       + FS + FS + ETX);
                        else if (getTransactionType().equalsIgnoreCase("REFUND")) {
                             System.out.println("--> REFUND send message to the pos terminal");
                             System.out.println("--> amount: " + amount);
                             System.out.println("--> transaction number: " + getTransactionNumber());
                             req = protocolStream("000000123405100" + getTransactionNumber() + FS + amount
                                       + FS + FS + "+0" + FS + "978" + FS + FS + FS + FS
                                       + FS + FS + FS + ETX);
            else if (getTransactionType().equalsIgnoreCase("VOID")) {
                             System.out.println("--> VOID transaction");
                             System.out.println("--> amount: " + amount);
                             System.out.println("--> transaction number: " + getTransactionNumber());
                             req = protocolStream("000000123410100" + getTransactionNumber() + FS      + FS + FS + "+0" + FS + "978" + FS + FS + FS + FS
                                       + FS + FS + FS + ETX);
            else if (getTransactionType().equalsIgnoreCase("TICKET")) {
                             System.out.println("--> TICKET duplicate");
                               req = protocolStream("000000123413100" + getTransactionNumber() + FS      + FS + FS + "+0" + FS + "978" + FS + FS + FS + FS
                                       + FS + FS + FS + ETX);
            else {
                             //nothing ;)
                        os.write(req);
                        os.flush();
                        l_ack_timeout = System.currentTimeMillis() + 1500;
                        //wait for half second
                        Thread.sleep(500);
                        l_timeout = System.currentTimeMillis() + l_wait_for; //add some time for timeout
                        phase = "TO_POS_ACK";
                        System.out.println("phase: " + phase);
                   }//phase null
                   //CHECK IF THE TIMEOUT OCCURED
                if (phase.equalsIgnoreCase("TO_POS_ACK") & (l_timeout < System.currentTimeMillis()) & (b_retry < 4))
                    b_retry += 1;
                    System.out.println("TIMEOUT: " + b_retry);
                    l_timeout = System.currentTimeMillis() + l_wait_for;
                    if (b_retry >= 4) {
                        System.out.println("Timeout occured");
                        closePort();
                        this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_timeout"));
                        break;
              //CHECK FOR THE ACKNOWLEDGE (FIRST RESPONSE FROM POS TERMINAL)
                if (phase.equalsIgnoreCase("TO_POS_ACK") &
                        (l_ack_timeout < System.currentTimeMillis())) {
                    try {
                        int numBytes = 0;
                        dataValue = "";
                        while ((numBytes = is.read(readBuffer)) > 0) {
                            dataValue += new String(readBuffer, 0, numBytes, "ASCII");
                        if (dataValue.getBytes().length > 0) {
                            System.out.println("->first byte: " +
                                dataValue.getBytes()[0]);
                            System.out.println("total length: " +
                                dataValue.getBytes().length);
                            //check for ack byte
                            if (dataValue.getBytes()[0] == 6) {
                                System.out.println(
                                    "<--ACKNOWLEDGE received from pos terminal");
                                phase = "WAIT_FOR_TRANSACTION";
                                l_timeout = System.currentTimeMillis() + l_wait_for_transaction;
                                System.out.println("-> wait for transaction response");
                    } catch (IOException ev) {
              //WAIT FOR TIMEOUT ON MESSAGE (watch dog timer)
                if (phase.equalsIgnoreCase("WAIT_FOR_TRANSACTION") &
                        (l_timeout < System.currentTimeMillis())) {
                    System.out.println(
                        "Error receiving response from pos terminal!!!");
                    closePort();
                    this.showError(res.getProperty("s_dlg_err_title"),
                                 res.getProperty("s_response_error"));
                  if (this.mHandler != null)
                    CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                    this.setErrorDescription(res.getProperty("s_response_error"));
                    dispatchCustomEvent(ce);
                    break;
              //WAIT FOR SOME DATA TO COME FROM POS TERMINAL OVER RS232
                if (phase.equalsIgnoreCase("WAIT_FOR_TRANSACTION")) {
                    try {
                        int numBytes = 0;
                        dataValue = "";
                        Thread.sleep(500);
                        while ((numBytes = is.read(readBuffer)) > 0) {
                            dataValue += new String(readBuffer, 0, numBytes, "ASCII");
                        if (dataValue.getBytes().length > 0) {
                            System.out.println("->first byte: " +
                                dataValue.getBytes()[0] + "|" +
                                dataValue.getBytes()[1]);
                            System.out.println("->ascii: " + dataValue);
                            System.out.println("total length: " +
                                dataValue.getBytes().length);
                            if (dataValue.indexOf("PREKINIL UPORABNIK") != -1) {
                                System.out.println(
                                    "Uporabnik je prekinil povezavo!");
                                  closePort();
                                //transaction cancelled by user s_user_cancel
                                this.showError(res.getProperty("s_dlg_err_title"),
                                             res.getProperty("s_user_cancel"));
                              if (this.mHandler != null)
                                CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                                this.setErrorDescription(res.getProperty("s_user_cancel"));
                                dispatchCustomEvent(ce);
                                break;
                            if (dataValue.indexOf("NAPACEN VNOS") != -1) {
                                System.out.println("Napačen vnos");
                                closePort();
                                //invalid user entry
                                this.showError(res.getProperty("s_dlg_err_title"),
                                             res.getProperty("s_user_invalid_entry"));
                               if (this.mHandler != null)
                                CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                                this.setErrorDescription(res.getProperty("s_user_invalid_entry"));
                                dispatchCustomEvent(ce);
                                break;
                            if (dataValue.indexOf("PROSIM POCAKAJ") != -1) {
                                System.out.println("<-- PROSIM POCAKAJ");
                                continue;
                            //preberemo podatke iz stringe terminala
                            if (dataValue.indexOf("SPREJETO") != -1) {
                                closePort();
                                System.out.println("<-- TRANSAKCIJA SPREJETA");
                                System.out.println(dataValue);
                                StringTokenizer st = new StringTokenizer(dataValue, "\034" );
                                String dv = st.nextToken();
                                sequentialNumber = dv.substring(6,10);
                                transactionProcessed = dv.substring(1, 3);
                                transactionFlag = dv.substring(13,15);
                                transactionNumber = dv.substring(15,21);
                                batchNumber = dv.substring(21,25);
                                transactionDate = dv.substring(25,31);
                                transactionTime = dv.substring(31,37);
                                transactionAmount = st.nextToken();
                                st.nextToken(); //Amount exponent
                                st.nextToken(); //Amount currency
                                cardDataSource = st.nextToken();
                                numberCustomerCard = st.nextToken();
                                expirationDate = st.nextToken();
                                st.nextToken(); // authorization code
                                terminalId = st.nextToken();
                                merchandId = st.nextToken();
                                companyName = st.nextToken();
                                System.out.println("================");
                                System.out.println(transactionProcessed);
                                System.out.println(transactionFlag);
                                System.out.println(transactionNumber);
                                System.out.println(batchNumber);
                                System.out.println(transactionDate);
                                System.out.println(transactionTime);
                                System.out.println(transactionAmount);
                                System.out.println(cardDataSource);
                                System.out.println(numberCustomerCard);
                                System.out.println(expirationDate);
                                System.out.println(terminalId);
                                System.out.println(merchandId);
                                System.out.println(companyName);
                                if (this.mHandler != null)
                                  System.out.println("dispatch custom event");
                                  CustomEvent ce = new CustomEvent(this.mHandler, EVT_OK);
                                  dispatchCustomEvent(ce);
                                return;
                    } catch (IOException ev) {
                      System.err.println("Exception sm: " + ev.toString());
                System.out.print('*');
                Thread.sleep(200);
              }//end state machine loop
          * protocolStream prepare the stream to be send over RS232 to POS terminal
          * with LRC cheksum control
          * @param data
          * @return byte[]
         private byte[] protocolStream(String data) {
              char STX = (char) 0x02;
              String tmp = "" + STX + STX + data + "" + getLRC(data);
              System.out.println("PStream: " + tmp);
              for (int i = 0; i < tmp.getBytes().length; i++) {
                   System.out.print(tmp.getBytes() + ":");
              return tmp.getBytes();
    * close port and stream
    private void closePort()
    try {
    serialPort.close();
    is.close();
    os.close();
    } catch (Exception ee) {
         * Longitudinal Redundancy Check (LRC)
         * @param packet
         * @return String
         private String getLRC(String packet) {
              char[] splitPacket = packet.toCharArray();
              char lrc = 0x00;
              for (int x = 0; x < splitPacket.length; x++) {
                   lrc = (char) (lrc ^ splitPacket[x]);
              return "" + (char) lrc;
         private String paddingString(String s, int n, char c, boolean paddingLeft) {
              if (s == null) {
                   return s;
              int add = n - s.length(); // may overflow int size... should not be a
              if (add <= 0) {
                   return s;
              StringBuffer str = new StringBuffer(s);
              char[] ch = new char[add];
              Arrays.fill(ch, c);
              if (paddingLeft) {
                   str.insert(0, ch);
              } else {
                   str.append(ch);
              return str.toString();
    public boolean setProperty(ID id, Object value)
    if (id.toString().equalsIgnoreCase("COMPORT")) {
    setComPort((String)value);
    System.out.println("RS232 com port: " + getComPort());
    return false;
    if (id.toString().equalsIgnoreCase("AMOUNT")) {
    this.setAmount((String)value);
    System.out.println("Amount value: " + getAmount());
    return false;
    if (id.toString().equalsIgnoreCase("TRANSACTIONTYPE")) {
    this.setTransactionType((String)value);
    System.out.println("Transaction Type value: " + this.getTransactionType());
    return false;
    if (id.toString().equalsIgnoreCase("EXECUTE")) {
    System.out.println("Invoke pos terminal");
    try
    doTransaction();
    catch(Exception ex)
    System.err.println("Execute Exception>> " + ex.toString());
    this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_gen_exception"));
    return false;
    return false;
         * Display error message inside oracle form
         * @param title
         * @param exceptionString
         private void showError(String title, String exceptionString) {
              JOptionPane.showMessageDialog(this, exceptionString, title, 0);
    Edited by: peterv6i.blogspot.com on May 8, 2012 10:18 AM
    Edited by: peterv6i.blogspot.com on May 8, 2012 10:20 AM
    Edited by: peterv6i.blogspot.com on May 8, 2012 10:21 AM

  • How do I pragmmatic​ally determine what comm ports my serial instrument​s are on?

    I am building a test stand that incorporates 5 serial instruments; 2 digital loads and 3 power supplies. I can use my PC's device manager to figure out which comm port each device is on and set the VISA Resource Name so everything runs as expected. All is well at this point. The problem comes in when an instrument's USB connection is unplugged and replugged, at which point the system may renumber the port assignments; the result is that my program errors out, I have to figure out what port everything is on all over again, and change the VISA Resource Name for all of my instruments. While this is a minor annoyance for me as the developer, this would make the program unusable by the user.
    While "don't ever unplug an instrument" is a sensible answer, the fact is that these things happen from time to time - like for calibration - so I want the program to work regardless of instruments being unplugged.
    Is there a way to have the vi automatically identify what port each instrument is on?

    I've used a USB connected barcode scanner that appears as a COM port. If it is left connected to the same USB port the COM port remains constant but if it is disconnected and then put back into a different port the COM port changes. This sounds similar to your problem so I'll share how I solved things for my application.
    The scanner I use accepts commands and will respond with a known string when I send a character 'I' via the serial connection. Using this I can see if the scanner is connected to the expected COM port (default port is stored in an ini file).
    If this fails I create an array of possible serial ports by trying to open COM1 and checking for an error. If this does not generate an error I add it to an array. Next I try the same with COM2, COM3 up to COM16 (for example). This gives me a list of COM ports I can open.
    I then iterate through the array trying for a response and stopping either when I get the expected response and continuing with the application or if the device is not found by the time I get to the end of the array I show the appropriate error condition to the operator.
    If your instruments can return some kind of ID that will allow you to identify them as mentioned in another reply then this method could be used. Your 3 power supplies and 2 digital loads would need to be able to return a unique identifier otherwise you wouldn't be able to tell them apart and I think you'd possibly run in to problems.

  • Accessing RS232 Port (Comm Port) from Applet

    I have an interesting "problem". I would like to create an applet that allows me to read the Comm port of the client machine but obviously I get a security exception when I try to do this. Firstly is this possible (I know it can be done from an application)? If so, how would I go about doing it?
    Thanks,
    Rishi

    you need to install the jre, and place the win32.dll at JavaSoft\JRE\1.3.1_06\bin, that properties file place at JavaSoft\JRE\1.3.1_06\lib, comm.jar at JavaSoft\JRE\1.3.1_06\lib\ext\
    and in ur code try to use it to open ur com port
    public String test() {
              String drivername = "com.sun.comm.Win32Driver";
              try
                   CommDriver driver = (CommDriver) Class.forName(drivername).newInstance(); driver.initialize();
              catch (Throwable th)
                   {* Discard it */}
              drivername = "javax.comm.*";
              try
                   CommDriver driver = (CommDriver) Class.forName(drivername).newInstance(); driver.initialize();
              catch (Throwable th)
                   {* Discard it */}
    portList = CommPortIdentifier.getPortIdentifiers();
    while (portList.hasMoreElements()) {
    portId = (CommPortIdentifier) portList.nextElement();
    if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
    if (portId.getName().equals("COM2")) {
    //if (portId.getName().equals("/dev/term/a")) {
    try {
    serialPort = (SerialPort)
    portId.open("SimpleWriteApp", 2000);
    } catch (PortInUseException e) {}
    try {
    outputStream = serialPort.getOutputStream();
    } catch (IOException e) {}
    try {
    serialPort.setSerialPortParams(9600,
    SerialPort.DATABITS_8,
    SerialPort.STOPBITS_1,
    SerialPort.PARITY_NONE);
    } catch (UnsupportedCommOperationException e) {}
                             int i=0;
                             while(true)
         try {
                                       messageString="hi";
                                       System.out.println(i++);
         outputStream.write(messageString.getBytes());
         } catch (IOException e)
                                       System.out.println(e);
                                       messageString=String.valueOf(e);
              return messageString;
    and yet u need to signed the applet
    1.     Compile the applet
    2.     Create a JAR file
    3.     Generate Keys
    4.     Sign the JAR file
    5.     Export the Public Key Certificate
    6.     Import the Certificate as a Trusted Certificate
    7.     Create the policy file
    8.     Run the applet
    Susan
    Susan bundles the applet executable in a JAR file, signs the JAR file, and exports the public key certificate.
    1.     Compile the Applet
    In her working directory, Susan uses the javac command to compile the SignedAppletDemo.java class. The output from the javac command is the SignedAppletDemo.class.
    javac SignedAppletDemo.java
    2.     Make a JAR File
    Susan then makes the compiled SignedAppletDemo.class file into a JAR file. The -cvf option to the jar command creates a new archive (c), using verbose mode (v), and specifies the archive file name (f). The archive file name is SignedApplet.jar.
    jar cvf SignedApplet.jar SignedAppletDemo.class
    3.     Generate Keys
    Susan creates a keystore database named susanstore that has an entry for a newly generated public and private key pair with the public key in a certificate. A JAR file is signed with the private key of the creator of the JAR file and the signature is verified by the recipient of the JAR file with the public key in the pair. The certificate is a statement from the owner of the private key that the public key in the pair has a particular value so the person using the public key can be assured the public key is authentic. Public and private keys must already exist in the keystore database before jarsigner can be used to sign or verify the signature on a JAR file.
    In her working directory, Susan creates a keystore database and generates the keys:
    keytool -genkey -alias signFiles -keystore susanstore -keypass kpi135 -dname "cn=jones" -storepass ab987c
    This keytool -genkey command invocation generates a key pair that is identified by the alias signFiles. Subsequent keytool command invocations use this alias and the key password (-keypass kpi135) to access the private key in the generated pair.
    The generated key pair is stored in a keystore database called susanstore (-keystore susanstore) in the current directory, and accessed with the susanstore password (-storepass ab987c).
    The -dname "cn=jones" option specifies an X.500 Distinguished Name with a commonName (cn) value. X.500 Distinguished Names identify entities for X.509 certificates.
    You can view all keytool options and parameters by typing:
    keytool -help
    4.     Sign the JAR File
    JAR Signer is a command line tool for signing and verifying the signature on JAR files. In her working directory, Susan uses jarsigner to make a signed copy of the SignedApplet.jar file.
    jarsigner -keystore susanstore -storepass ab987c -keypass kpi135 -signedjar SSignedApplet.jar SignedApplet.jar signFiles
    The -storepass ab987c and -keystore susanstore options specify the keystore database and password where the private key for signing the JAR file is stored. The -keypass kpi135 option is the password to the private key, SSignedApplet.jar is the name of the signed JAR file, and signFiles is the alias to the private key. jarsigner extracts the certificate from the keystore whose entry is signFiles and attaches it to the generated signature of the signed JAR file.
    5.     Export the Public Key Certificate
    The public key certificate is sent with the JAR file to the whoever is going to use the applet. That person uses the certificate to authenticate the signature on the JAR file. To send a certificate, you have to first export it.
    The -storepass ab987c and -keystore susanstore options specify the keystore database and password where the private key for signing the JAR file is stored. The -keypass kpi135 option is the password to the private key, SSignedApplet.jar is the name of the signed JAR file, and signFiles is the alias to the private key. jarsigner extracts the certificate from the keystore whose entry is signFiles and attaches it to the generated signature of the signed JAR file.
    5: Export the Public Key Certificate
    The public key certificate is sent with the JAR file to the whoever is going to use the applet. That person uses the certificate to authenticate the signature on the JAR file. To send a certificate, you have to first export it.
    In her working directory, Susan uses keytool to copy the certificate from susanstore to a file named SusanJones.cer as follows:
    keytool -export -keystore susanstore -storepass ab987c -alias signFiles -file SusanJones.cer
    Ray
    Ray receives the JAR file from Susan, imports the certificate, creates a policy file granting the applet access, and runs the applet.
    6.     Import Certificate as a Trusted Certificate
    Ray has received SSignedApplet.jar and SusanJones.cer from Susan. He puts them in his home directory. Ray must now create a keystore database (raystore) and import the certificate into it. Ray uses keytool in his home directory /home/ray to import the certificate:
    keytool -import -alias susan -file SusanJones.cer -keystore raystore -storepass abcdefgh
    7.     Create the Policy File
    The policy file grants the SSignedApplet.jar file signed by the alias susan permission to create newfile (and no other file) in the user's home directory.
    Ray creates the policy file in his home directory using either policytool or an ASCII editor.
    keystore "/home/ray/raystore";
    // A sample policy file that lets a JavaTM program
    // create newfile in user's home directory
    // Satya N Dodda
    grant SignedBy "susan"
         permission java.security.AllPermission;
    8.     Run the Applet in Applet Viewer
    Applet Viewer connects to the HTML documents and resources specified in the call to appletviewer, and displays the applet in its own window. To run the example, Ray copies the signed JAR file and HTML file to /home/aURL/public_html and invokes Applet viewer from his home directory as follows:
    Html code :
    </body>
    </html>
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    width="600" height="400" align="middle"
    codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,1,2">
    <PARAM NAME="code" VALUE="SignedAppletDemo.class">
    <PARAM NAME="archive" VALUE="SSignedApplet.jar">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
    </OBJECT>
    </body>
    </html>
    appletviewer -J-Djava.security.policy=Write.jp
    http://aURL.com/SignedApplet.html
    Note: Type everything on one line and put a space after Write.jp
    The -J-Djava.security.policy=Write.jp option tells Applet Viewer to run the applet referenced in the SignedApplet.html file with the Write.jp policy file.
    Note: The Policy file can be stored on a server and specified in the appletviewer invocation as a URL.
    9.     Run the Applet in Browser
    Download JRE 1.3 from Javasoft
    good luck! [email protected]
    i already give u many tips, i use 2 weeks to try this to success, hopw that u understand that, a result of success is not important, the process of how to get things done is most usefull!

  • Comm port passthrough

    Customer has an old Windows 2003 SBS server that has a Novatime time clock plugged into it via a comm port.
    They now have a new server running 2012 (not R2) in Hyper-V role only with 4 2012 VMs (all licensing correct). They want to get rid of the old server (need to) but
    the time clock prevents that.
    I know we can get a serial 2 USB adapter cable so the time clock can be plugged into the Hyper-V server. Is there any way to pass through the USB comm to one of the VMs
    which would have the Novatime software on it? Would it require a comm card to be added to the Hyper-V server?
    Jonathan

    i think your best bet would be this product (haven't tested it): http://www.serial-server.net/port-redirector/ afaik COM redirection isn't supported on Hyper-V.
    Some people seem to have tested it and shared findings on the matter in this thread: http://social.technet.microsoft.com/Forums/windowsserver/en-US/a7b09e73-3491-405e-889e-06bb991a2b0e/com-port-redirection-physical-to-virtual
    Kind regards, Philipp - Solid IT Solutions
    Philipp,
    thanks for your response. I read through the links you provided and the first one certainly looks like it will do what I need.
    Jonathan

  • Too many usb comm ports

    Good Morning,
        I've run into what may be issue soon, where we have the units being tested that have built in USB ports that appear as serial comm ports. The problem is that every time we connect a UUT that hasn't been run on that computer before Windows assigns it a new com port number. My concern is that quite soon, as the production line gets into full swing, we will hit the "magic number" of 255, the highest com port number and I don't have any idea what Windows will do at that point. Before I start writing code to parse the new com port number returned by VISA, and adjust" the registry entries accordingly, I want to know if it is necessary. I figure that there are a couple of possible scenarios, that Windows complains and won't issue a com port #, that Windows starts over at the beginning, or that Windows just hits 255 and then keeps reissuing it. I would prefer that it be the later two, don't want to have my program messing around in the registry, and really don't have time at the moment, nor access to the machine(s) to experiment to see.
    Thanks,
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion
    Solved!
    Go to Solution.

    I'm not sure that I understand your answer. The problem is that on our test stands we will see hundreds of the product boards go by over the life of the boards. As I have seen with "standalone" usb-serial adapters, when a new one is plugged in, that the computer hasn't "seen" before, it will assign it the next available comm port #. It probably knows that it hasn't seen it before by some serial numbering type scheme that is returned in the USB's header info when plugged in. As the hardware design for the unit containing this USB interface is essentially frozen, and as that side of the design group won't see it as a problem in the target systems (where the boards won't be "talked to" via the USB path) it is unlikely that I can get any hardware/firmware changes. I'm not sure that would be the way to go anyway. Definitely not going to get a change to the BOM at this point (on top of which I'm an outside contract test consultant). So I will have to address the problem on my side of the fence. I haven't looked yet, but am pretty certain that the Com#'s are stored in the registry, so I can just make sure that I "reset" those numbers before they get to 255, but am never comfortable with my programs modifying the registry.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Cant use DVI-D port with DVI-D cable from Pav 500-100a to HP W2207 monitor

    I have a new Pav 500-100a factory standard with no mods.  A HP w2207 monitor.
    Currently connect fine with VGA to the DVI-D port with the adapter that came with the pc.  I've setup Windows, updated to 8.1, put in my files from my old PC and all was well except video isnt that good.
    I got a DVD cable form work but its a DVI-I cable.  It took 5 mins before windows comes up and then whenever the background picture changed in the theme it hung for a few seconds.  I read that I need a DVD-D cable which i purchasd today.
    The packet says its a CL-DVI2M - DVI M/M 24+1 CABLE 2M.  The tech in the shop says its a good calbe and will work fine.
    When connected and I power up I get teh hp logo and rolling dots then it goes blank.
    I reconnect teh VGA cable and its all fine - using the VGA to DVI adapter.
    I ran msconfig and turned of safe boot - restarts and comes up fine in safe mode.  I set the resolution to 1280x800 and restarted and reconnected the DVI cable - blank again.
    If I put the VGA cable back in it boots fine.  The monitor has been factory reset and seens the DVI connection but Windows remains blank. Also tried booting first with no cable - connect teh DVI and the monitor remains in sleep - power reset teh monitor and still blank also shows no DVO conenction.
    I fI power up with DVI connected I can get to BIOS, and i see the HP logo and dots as Win 8 starts.
    I dont know what else I can try.  I have no other usable video card with DVI
    Any ideas out there?
    Pls help - Steve
    Although I am an HP employee, I am speaking for myself and not for HP.
    This question was solved.
    View Solution.

    Hi Steve,
    Only connect one active video cable to the monitor and do not use any adapters.
    Use a flashlight and examine the DVI connector on the monitor.  Which DVI type is it?
    Some of the older HP monitors have DVI issues so you might want to check with HP Support and see if you have one of those models.
    An older post a long time back indicated that audio also had to be feed to the monitor (claimed by a poster).  If this is indeed true then it's a monitor design flaw. So, you could use a native HDMI cable and test out that claim. 
    HP DV9700, t9300, Nvidia 8600, 4GB, Crucial C300 128GB SSD
    HP Photosmart Premium C309G, HP Photosmart 6520
    HP Touchpad, HP Chromebook 11
    Custom i7-4770k,Z-87, 8GB, Vertex 3 SSD, Samsung EVO SSD, Corsair HX650,GTX 760
    Custom i7-4790k,Z-97, 16GB, Vertex 3 SSD, Plextor M.2 SSD, Samsung EVO SSD, Corsair HX650, GTX 660TI
    Windows 7/8 UEFI/Legacy mode, MBR/GPT

  • Identifying a comm port using java communication API

    HI ALL,
    i'm using the communication API to detect the comm port to which my modem is attached.
    i say CommPortIdentifier c = CommPortIdentifier.getPortIdentifier("COM3");
    then i SOP(c.getName())
    i get an exception saying noSuchPortException
    i've put the javax.comm.properties file in jdk/lib but to no avail.
    i also have a win32com.dll file that is there inside lib.
    but this hasn't helped. Now the properties file has a driver mentioned. do i have 2 download that driver or does it come with the OS (i've no idea)
    i would be helpful if anybody could help me out with this problem.

    Try putting tha javax.comm.properties file in you <java>/jre/lib folder as well... It worked for me !

  • 802.1x per host authentication under one port with multi-host access by hub

    Dear,
    While multi-host connect to one port by hub, it seems that in multi-host mode, after one host passed the authentication, the port change state to up, and the other hosts do not need to authenticate any more. And in single host mode, only one host could access to the network under one port.
    In the situation with multi-host access to one port by hub, is it possible that we could control per user access by authentication for each?
    We did some test on 3550, it seems that the 3550 doesnot support what we need. And what about 4506?
    Thanks!

    Multiauthentication Mode
    Available in Cisco IOS Release 12.2(33)SXI and later releases, multiauthentication (multiauth) mode allows one 802.1X/MAB client on the voice VLAN and multiple authenticated 802.1X/MAB/webauth clients on the data VLAN. When a hub or access point is connected to an 802.1X port (as shown in Figure 60-5), multiauth mode provides enhanced security over the multiple-hosts mode by requiring authentication of each connected client. For non-802.1X devices, MAB or web-based authentication can be used as the fallback method for individual host authentications, which allows different hosts to be authenticated through different methods on a single port.
    Multiauth also supports MDA functionality on the voice VLAN by assigning authenticated devices to either a data or voice VLAN depending on the data that the VSAs received from the authentication server.
    Release 12.2(33)SXJ and later releases support the assignment of a RADIUS server-supplied VLAN in multiauth mode, by using the existing commands and when these conditions occur:
    •The host is the first host authorized on the port, and the RADIUS server supplies VLAN information.
    •Subsequent hosts are authorized with a VLAN that matches the operational VLAN.
    •A host is authorized on the port with no VLAN assignment, and subsequent hosts either have no VLAN assignment, or their VLAN information matches the operational VLAN.
    •The first host authorized on the port has a group VLAN assignment, and subsequent hosts either have no VLAN assignment, or their group VLAN matches the group VLAN on the port. Subsequent hosts must use the same VLAN from the VLAN group as the first host. If a VLAN list is used, all hosts are subject to the conditions specified in the VLAN list.
    •After a VLAN is assigned to a host on the port, subsequent hosts must have matching VLAN information or be denied access to the port.
    •The behavior of the critical-auth VLAN is not changed for multiauth mode. When a host tries to authenticate and the server is not reachable, all authorized hosts are reinitialized in the configured VLAN.
    NOTE :
    •Only one voice VLAN is supported on a multiauth port.
    •You cannot configure a guest VLAN or an auth-fail VLAN in multiauth mode.
    for more information :
    http://www.cisco.com/en/US/docs/switches/lan/catalyst6500/ios/12.2SX/configuration/guide/dot1x.html

  • Why can't I extend my wired TC port with linksys switch?

    Why can't I extend my wired TC port with linksys switch?

    Temporarily, connect a laptop to one of the LAN <-> ports on the TC using an Ethernet cable. Turn off wireless on the laptop. Can the laptop connect to the Internet?
    If yes, you know the port is working and the Ethernet cable is working.
    If yes, connect the switch to the same Ethernet cable. I assume that you are using an "unmanaged" switch. Some switches may need to be powered off and restarted.
    If no on the first test, try another Ethernet cable that you know is working. Try another LAN <-> port as well.
    The whole idea is to start at the TC and work outward step by step, checking each connection and step along the way.

  • Solving Prolific PL-2303 USB to Serial Comm Port installation issues

    Hello everybody,
    More and more machines are comming without Parallel and serials ports, they are comming with USB external ports only.
    Some have the RS-232 and Parallel headers in the motherboard, and that should last for about a year I think.
    At any rate, the issue I was facing is the following:
    (a) Installing Prolific PL-2303 USB to Serial Comm Port on Windows XP Pro SP3 works OK and system runs fine. there are some capacity issues regarding the buffer size, but that is another post.
    (b) Installing on WEPOS 1.1 SP3 on some motherboards (Older ones) that have at least the Parallel headers and a serial port, the device also works as with (a)
    (c) Installing on WEPOS 1.1 SP3 with a machine with only external USB's (no parallel / serial port or headers). The installation process runs OK. but when the device
    is plugged I get the following error message:
    "An error ocurred during the installation of the device"
    "A service Installation section in this INF is invalid"
    (d) Installing on POSReady 2009. I get the same as with (c)
    This is how I solved, after many frustrating reboots with the same message about the INF section and multiple Prolific drivers tried.  I started digging windows:
    (1) Find the setupapi.log and read it, if the OS is a fresh install it will not be too long.
    (2) Read this:
    #-166 Device install function: DIF_SELECTBESTCOMPATDRV.
    #I063 Selected driver installs from section [ComPort] in "c:\windows\inf\oem15.inf".
    #I320 Class GUID of device remains: {4D36E978-E325-11CE-BFC1-08002BE10318}.
    #I060 Set selected driver.
    #I058 Selected best compatible driver.
    #-166 Device install function: DIF_INSTALLDEVICEFILES.
    #I124 Doing copy-only install of "USB\VID_067B&PID_2303\5&B6C3FC&0&2".
    #-166 Device install function: DIF_REGISTER_COINSTALLERS.
    #I056 Coinstallers registered.
    #-166 Device install function: DIF_INSTALLINTERFACES.
    #-011 Installing section [ComPort.NT.Interfaces] from "c:\windows\inf\oem15.inf".
    #I054 Interfaces installed.
    #-166 Device install function: DIF_INSTALLDEVICE.
    #I123 Doing full install of "USB\VID_067B&PID_2303\5&B6C3FC&0&2".
    #-035 Processing service Add/Delete section [ComPort.NT.Services].
    #E339 Add Service: Binary "C:\Windows\system32\DRIVERS\serenum.sys" for service "Serenum" is not present.
    #E032 Error 0xe0000217: A service installation section in this INF is invalid.
    #E275 Error while installing services. Error 0xe0000217: A service installation section in this INF is invalid.
    #E122 Device install failed. Error 0xe0000217: A service installation section in this INF is invalid.
    #E154 Class installer failed. Error 0xe0000217: A service installation section in this INF is invalid.
    [2010/02/13 23:32:24 2004.2]
    (3) So it was the serenum.sys file that Windows needed to find in the ..\system32\drivers folder. I got the serenum.sys from one of the temporary folders created by the installation process.
    (3a) So, I think that windows installs this sys file if it recognizes the motherboard has at least one parallel or serial port.
    (4) So good luck when installing your serial device to your POS solution. I will open another thread if I have problems with the buffer size of the device.
    Humberto Sequeira

    Hello Terry,
    Indeed, they were not intended as POS system, the EEE Top machines are candy to the eye, but for my taste they do not work in POS environment (I give them 1 year before they pop). Regarding the other, well competition is tought, so you have to get creative in order to keep costs down, and this one can be used as a waiter stations, that do not need heavy serial comunications.
    Anyways, the POSReady does not install these system files if the installation does not detect a serial or parallel port (which make sense, as why would it install drivers for a device that is not detected). I posted this for others to be aware of this when they select the hardware that will be offered to their customers, as good old "on mother-board" serial and parallel ports cannot be beaten by their USB imitations (IRQ and memory addressing processing are needed for end devices to function properly).
    Have a great weekend,
    Humberto

  • Unity Connection 1.2(1) which has SCCP ports with CallManager 8.5(1)SU1.

    For 24 hours I’d like to run Unity Connection 1.2(1) which has SCCP ports with CallManager 8.5(1).  Unity Connection 1.2 isn’t supported anymore, we are migrating to Unity Connection 8.5(1) but I wanted to do CallManager 4x to 8x upgrade the first night, and Unity Connection 1.2 to 8.5 upgrade the second night. All new hardware so using DMA and COBRAS.
    I'm not looking for it to be "Supported" just want it to work 24 hours while migrating...
    Unity Connection 1.x Compatability Matrix will likely never show CallManager 8.5 since UC 1.x is EoL
    http://www.cisco.com/en/US/docs/voice_ip_comm/connection/compatibility/matrix/cucsccpmtx.html
    Jason Aarons
    CCNP/CCDP/CCVP
    Consultant

    The primary factor in the integration here for SCCP is the TSP version.  You can verify the version of TSP running on Unity Connection with the procedure noted here:  http://www.cisco.com/en/US/docs/voice_ip_comm/connection/1x/release/notes/121sr2ucrn.html#wp37944
    It's a Windows box so the procedure is the same as with standard Unity.  Check the properties of AvSkinny.tsp in the \Windows\System32\ folder path.
    If you don't care about official support and it's only temporary then I'd say check to ensure that TSP is fairly recent and, if needed, upgrade to the latest release available for install on CUC 1.2(1).  Run a number and tests and make sure 1) things function as expected and 2) you don't get a load of TSP errors in the system/application logs.
    Cisco notes that product support is based primarily on testing and since Unity Connection 1.2(1) is outdated and CUCM 8.5(1) is brand new, it's not likely that this combination will be tested anytime soon ... but the TSP compatibility between 8.0 and 8.5 is likely to be similar if not the same.
    Hailey
    Please rate helpful posts!

  • Wiring FP-1001 to a comm port on my computer?

    I am trying to wire my FP-1001 to my PC. I purchased a 9pin serial port connecter in hope that all I had to do was plug the female end into comm port one, splice the other end and connect them to RX+, RX-, TX+, TX- and GND. My only problem is how do I know which wires go where? Or do I need to purchase a RS-485 card for my PC.

    Hi all
    That is not quite true!National Instruments is selling PCI-485 boards with two, four or eight ports.
    Under this link you find a quick start guide how to connect the FP-1001 to a RS-485 port.
    http://digital.ni.com/manuals.nsf/webAdvsearch/554FEB385A006C8E86256AC300647F62?OpenDocument
    Regards,
    Luca

  • HP 6550b BIOS Unabled COMM PORT (SERIAL)

    Hi,
    I have an HP Probook 6550b with BIOS version F.23, I can see my Ricoh PCI connections like USB, SD/MMC Reader and the 1394 Port, but I can't found my Serial COMM PORT??
    Thx for your Help!

    Hi:
    Did you install the AMT driver?
    http://h20565.www2.hp.com/portal/site/hpsc/template.PAGE/public/psi/swdDetails/?sp4ts.oid=3688870&sp...

Maybe you are looking for