COMM Api problems to send a CR (13 or ^M) character.

I am trying to get familiar with the COMM API, I use the examples in the package like "BlackBox", or "SerialDemo".
They work fine, but I realized there is no way to send an "enter" to my router I am trying for testing the COM.
With any other term program on my COM1 I have no problems, both with standard ASCII characters, and with any control character (0-32), thus including "enter" (CR, 13, ^M are equivalents as far as I know).

When trying to send ASCII characters, make sure that you don't send a String, as Java strings are Unicode characters consisting of two bytes. Standard ASCII uses the bottom 7-bits of a byte. The send an Enter or Return chararcter, use the primative type: char
char myEnterChar = '\r';Cheers,
- David

Similar Messages

  • Comm API problems RS232 SerialDemo

    Hello,
    before you ask: yes, i have read a lot of postings concerning this topic.
    However, my problem is different than the common Comm API problems.
    Win2000, JDK 1.5.2, Comm API 2.0.
    The SerialDemo compiles (wow), shows the correct COM Ports (1) (this has been a major problem in a lot of postings), and works without exceptions. Great, but i dont get any serialEvent when i send something from my device on COM1 (a balance).
    I know the RS232 parameters (1200,7 data bits, 1 stop bit, parity odd), and i connected this device without problems to a Delphi application.
    Cable is the same and the correct one. The device sends with CRLF (ASCII 13 and 10) at the end of each string.
    I tried SimpleRead.java too, but here the same: no serialEvent has been triggered when the device sends its data.
    Any ideas?
    Oliver

    Hi
    sorry, it does work now :)
    It was the device itself which was causing the problem.
    But i really wasnt expecting this, because the day before the device (a balance) worked without any problems. Its quite funny that the balance stopped working just the day i started with the Java communication :)
    thanks
    Oliver

  • Comm API Problems

    Hi Everyone,
    I've just installed the comm API, and installation process seems to have gone quite smoothly, (the code is compilling correctly), but the demo programs will not run, i get the error:
    Exception in thread "main" java.lang.NoClassDefFoundError: SimpleWrite
    or the same error coming from SimpleRead.
    Any ideas on whats going on?
    Andrew

    You can't use directory names that have a space in
    them when using Java.Okay, I've uninstalled the java sdk, installed it to
    C:\jdk
    copied the win32.dll to the jdk\bin directory
    and the properties and comm.jar file to the jdk\lib directory
    reset the classpath using
    set CLASSPATH=c:\jdk\lib\comm.jar
    and it's still not working, any other suggestions?

  • Comm API problems (getPortIdentifier)

    Hi! I wrote an applet that uses the javax.comm API to manage a serial port in the host machine. When first develop it with JDK 1.1.8 the applet (and an application) runs perfectly. I now have Java 2 (jdk1.3.1._02) and I'm trying to run this applet and when it arrives to a CommPortIdentifier.getPortIdentifier(String) call, I got this message:
    "java.io.lang: name can't be null"
    First I thought that was my applet, that my application was wrong, so I try to use de SerialDemo example that comes with the javax.comm and It doesn't work either! If I run it with the latest beta version of JDK (1.4 I think) it runs again... any idea???
    Thanks a lot! =)

    in jdk1.3...
    u have to copy the win32com.dll and comm.properties file in the jre\1.3\bin folder of the machine
    and comm.jar in the jre\1.3\lib folder....
    remember, in windows, u will get the
    ...\program files\javasoft\jre\1.3\lib or ..\bin
    ther u have to store not in ur c:\jdk1.3\bin
    Regards,
    Ritesh

  • COMM API problem

    Hello there
    I am hoping you can help me with following. I am trying to transfer files from one computer
    to another using a serial port and hence I am using the communications api. I have gotten so
    many errors on the problem. I have followed the information for installing the api but I
    still get errors. It will let me compile a file but when I try to run it it give me the
    following error
    NoClassDeffounder found
    What my lecturer did was opened up the jar file and put them into a separate folder. We then
    put them into the bin directory in the jdk.
    Everywhere in the code where it was calling a class,constant belong to the api we did the
    following
    comm.CommPortIdentifier.getPortIdentifiers();
    In the above line comm is the folder with the class files
    When we try to tun it now it executes.But it still cannot find any ports whatsoever
    Please can anyone at all help. I am stuck on this problem for over a month and is slowing me down
    Thanks

    No the code has not come from my tutor
    I've had 2 experts trying to help me and they dont
    know what the problem is
    I have tried the SerialDemo
    I still get the same result
    Any other ideasIf you have followed these instructions to the letter, which I doubt, then you probably need to re-install Windows.
    If they haven't fixed this relatively simple problem they are not experts. Consultants perhaps, but not experts.

  • Problem in sending data to parallel port

    Hello,
    I can open a parallel port (LPT1) using java comm api i,e javax.comm.
    but problem in sending data to parallel port,
    I choose the appropriate port(LPT1), it is in bi-directional mode according to BIOS configuration.
    but according to the java program the mode is SSP.
    when i write data to parallel port the volt-meter give a reading of high state for all data pin (pin1 to 9) i,e the parallel port doesnot change state. I am using windows XP.
    What is the solution?

    try it on Open Solaris 10 or Linux platform.
    also just try using the new FileWriter("LPT1").write("Hello");
    on windows platform
    Pravin

  • COMM api ParallelPort locks

    Hello all,
    I'm trying to use the Parallel Port from COMM api just to send 1 byte to Paralell data I/O using the code below,
    portList = CommPortIdentifier.getPortIdentifiers();
    while (portList.hasMoreElements()) {
    portId = (CommPortIdentifier) portList.nextElement();
    portId.getPortType());
    if (portId.getPortType() == CommPortIdentifier.PORT_PARALLEL) {
    try {
    parallelPort = (ParallelPort) portId.open("MoodMusic", 2000);
    } catch (PortInUseException e) { }
    // Writing to port
    try {
    outputStream = parallelPort.getOutputStream();
    outputStream.write("Hello World".getBytes());
    } catch (Exception e) { System.out.println(e.getMesssage());}
    And the application keep locked when I proceed the write method,
    I do not need read anything from Parallel Port and I have no device connected it.
    Is it possible to use the ParalelPort class just to send bytes , It is needed something else to work? or It just work for printers.
    best regards,

    Thank you very much Jos,You're welcome.
    But I really do not understand the solution you proposed, I really need
    an answer from device or Could I solve it from PC Host?Sun's API expects that nAck negative pulse; if it doesn't arrive it won't
    send new data. You either need to fake that pulse (using a bit of
    additional hardware triggered by the strobe signal coming from the host)
    or maybe (just a quick idea), you could set a small timeout value and
    try to send your bytes one by one. This would slow down the communication
    speed substantially but you don't need to build special hardware.
    If your device is fast enough it would pick up the eight bits of data and
    then Sun's API would time out. This way you also lose quite a lot of
    functionality like error detection etc.
    kind regards,
    Jos

  • Problem in sending messages using java mail api

    Hi All,
    I have a problem in sending messages via java mail api.
    MimeMessage message = new MimeMessage(session);
    String bodyContent = "ñSunJava";
    message.setText (bodyContent,"utf-8");using the above code its not possible for me to send the attachment. if i am using the below code means special characters like ñ gets removed or changed into some other characters.
    MimeBodyPart messagePart = new MimeBodyPart();
                messagePart.setText(bodyText);
                // Set the email attachment file
                MimeBodyPart attachmentPart = new MimeBodyPart();
                FileDataSource fileDataSource = new FileDataSource("C:/sunjava.txt") {
                    public String getContentType() {
                        return "application/octet-stream";
                attachmentPart.setDataHandler(new DataHandler(fileDataSource));
                attachmentPart.setFileName(filename);
                Multipart multipart = new MimeMultipart();
                multipart.addBodyPart(messagePart);
                multipart.addBodyPart(attachmentPart);
                message.setContent(multipart);
                Transport.send(message);is there any way to send the file attachment with the body message without using MultiPart java class.

    Taken pretty much straight out of the Javamail examples the following works for me (mail read using Thunderbird)        // Define message
            Message message = new MimeMessage(session);
            message.setFrom(new InternetAddress(from));
            // Set the 'to' address
            for (int i = 0; i < to.length; i++)
                message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
    // Set the 'cc' address
    for (int i = 0; i < cc.length; i++)
    message.addRecipient(Message.RecipientType.CC, new InternetAddress(cc[i]));
    // Set the 'bcc' address
    for (int i = 0; i < bcc.length; i++)
    message.addRecipient(Message.RecipientType.BCC, new InternetAddress(bcc[i]));
    message.setSubject("JavaMail With Attachment");
    // Create the message part
    BodyPart messageBodyPart = new MimeBodyPart();
    // Fill the message
    messageBodyPart.setText("Here's the file ñSunJava");
    // Create a Multipart
    Multipart multipart = new MimeMultipart();
    // Add part one
    multipart.addBodyPart(messageBodyPart);
    // Part two is attachment
    for (int count = 0; count < 5; count++)
    String filename = "hello" + count + ".txt";
    String fileContent = " ñSunJava - Now is the time for all good men to come to the aid of the party " + count + " \n";
    // Create another body part
    BodyPart attachementBodyPart = new MimeBodyPart();
    // Get the attachment
    DataSource source = new StringDataSource(fileContent, filename);
    // Set the data handler to this attachment
    attachementBodyPart.setDataHandler(new DataHandler(source));
    // Set the filename
    attachementBodyPart.setFileName(filename);
    // Add this part
    multipart.addBodyPart(attachementBodyPart);
    // Put parts in message
    message.setContent(multipart);
    // Send the message
    Transport.send(message);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Problem in Accessing serial port using java comm Api

    I have installed java comm Api in my pc.
    i have gone through the instalation instruction which comes on this package.
    I have done the instalation like this
    Copy win32com.dll to my <JDK>\bin directory.
    Copy comm.jar to my <JDK>\lib directory.
    Copy javax.comm.properties to my <JDK>\lib directory.
    and restart the system.
    But when i run the BlackBox , it is giving me message
    "serial port not found".
    Can any one tell me , what is the exact problem ?

    I'm not sure what you mean by BlackBox, but I have used the COMM api extensively.
    The majority of problems is that the api cannot see the serial port (which is what you are describing) and this is caused by incorrect placing of the javax.comm.properties file.
    As well as <JDK>\lib, try putting it into <JRE>\lib as well. That has often solved problems on my setup.

  • Problem with sending mail throgh java mail api

    hi folks,
    We are having problem regarding sending mail using java mail api.
    we are using msgsendsample.java file from demo folder contained in javamail-1.3.3_01 folder.
    we are using following command at dos prompt.:
    java msgsendsample [email protected] [email protected] smtp.mail.yahoo.com false
    It gives following Exception:
    --Exception handling in msgsendsample.java
    com.sun.mail.smtp.SMTPSendFailedException: 530 authentication required - for hel
    p go to http://help.yahoo.com/help/us/mail/pop/pop-11.html
    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1
    333) at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:906)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:535)
    at javax.mail.Transport.send0(Transport.java:151)
    at javax.mail.Transport.send(Transport.java:80)
    at msgsendsample.main(msgsendsample.java:93)
    ** ValidUnsent Addresses
    [email protected]
    Thanking in Advance...
    Please give us guidance to any alternate solution if exists.

    hi
    the smtp server u are using should allow u to send mail to other smtp server like if u r sending mail to yahoo account u have to use yahoo smtp server only .....
    bye

  • Help...problems using java comm API

    Hi all
    im using Fedora Core and in order to list all the available serial ports for my computer i'm using the classic program TestEnumeration, but when running from jbuilder 2005 not from shell i received the following errors:
    Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path
    Caught java.lang.UnsatisfiedLinkError: readRegistrySerial while loading driver com.sun.comm.SolarisDriver
    Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path
    Caught java.lang.UnsatisfiedLinkError: readRegistrySerial while loading driver com.sun.comm.SolarisDriver
    warning: no ports found - make sure javax.comm.properties file is found
    i have followed all the instruction to install comm API but i received the same error i need help plz if someone can
    thx

    import java.io.*;
    import java.util.*;
    import javax.comm.*;
    import java.lang.*;
    import java.Buff.*;
    public class SimpleRead implements Runnable, SerialPortEventListener
         static CommPortIdentifier portId;
         static Enumeration portList;
         InputStream inputStream;
         SerialPort serialPort;
         Thread readThread;
         public static void main(String[] args)
         {//System.out.println("hello");
              portList = CommPortIdentifier.getPortIdentifiers();
              while (portList.hasMoreElements())
                   portId = (CommPortIdentifier) portList.nextElement();
                   if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL)
              if (portId.getName().equals("COM1"))
                   // if (portId.getName().equals("/dev/term/a")) {
              SimpleRead reader = new SimpleRead();
         public SimpleRead()
         try
              serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
         catch (PortInUseException e)
                                  System.out.println(e);
         try
         inputStream = serialPort.getInputStream();
         catch (IOException e)
                        System.out.println(e);
                   try
    serialPort.addEventListener(this);
                   catch (TooManyListenersException e)
                        System.out.println(e);
         serialPort.notifyOnDataAvailable(true);
         try
         serialPort.setSerialPortParams(9600,
    SerialPort.DATABITS_8,
    SerialPort.STOPBITS_1,
    SerialPort.PARITY_NONE);
              catch (UnsupportedCommOperationException e)
                        System.out.println(e);
    try {
    out = new OutputStreamWriter(serialPort.getOutputStream());
    out.write("ATQ0V1E0");
    out.flush();
    out.write("ATQ0V1E0");
    Out.close();
    //System.out.println("ATQ0V1E0");
    catch (IOException e) {}
    try {
    int line;
    int result ;
    InputStream = serialPort.getInputStream();
    int num= inputStream.available();
    InputStreamReader reader = new InputStreamReader(inputStream);
    System.out.println(reader.ready());
    while ((line = reader.read()) <= 0)
    result =reader.read();
    System.out.println("Success " + result);
    reader.close();
    catch (IOException e) {}
    readThread = new Thread(this);
    readThread.start();
    try {
    OutputStream = SerialPort.getOutputStream();
    catch (IOException e) {}
              System.out.println("ATQ0V1E0");
    public void run()
         try
    Thread.sleep(500);
    catch (InterruptedException e)
                   System.out.println(e);
    public void serialEvent(SerialPortEvent event)
    switch(event.getEventType())
    case SerialPortEvent.BI:
    case SerialPortEvent.OE:
    case SerialPortEvent.FE:
    case SerialPortEvent.PE:
    case SerialPortEvent.CD:
    case SerialPortEvent.CTS:
    case SerialPortEvent.DSR:
    case SerialPortEvent.RI:
    case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
    break;
    case SerialPortEvent.DATA_AVAILABLE:
    byte[] readBuffer = new byte[20];
    try
    while (inputStream.available() > 0)
    int numBytes = inputStream.read(readBuffer);
    System.out.print(new String(readBuffer));
    catch (IOException e)
                        System.out.println(e);
    break;
    hi friends am getting these errors
    C:\programs>javac SimpleRead.java
    SimpleRead.java:115: illegal start of expression
    public void run()
    ^
    SimpleRead.java:159: ';' expected
    ^
    2 errors
    please help me....
    its very urgent....this is the first program of mine.... am so tensed..
    i should finish this soon... please help me...
    this is my mail ID
    [email protected]

  • Comm Api In IRDA

    I Have connected IRDA in USB and Create a virtual modem com4.My work is to send message between mobile through PC and vice versa.First We work on serial cable connected with my PC and Nokia6610.But
    I face lot of Problem with AT command so I wanna be work with IRDA because All AT command work fine.
    I test it in Hyperterminal.But We will be implemented it only one way and that is comm api.But Comm api works on Serial and Parallal Port.But I create Virtual port com4.Can i do it in comm api with IRDA connection?
    I Want to know Only One Thing----------------
    Can i work IRDA with my comm API?
    (Though It is not connected with the serial port but create a virtual port com4)
    PLS & PLS Help Me Only This ANS.

    If your operating system works it as a comm port you can readily run the BlackBox example that comes with the comm 2.0 API and see if it picks it up.

  • Is Comm Api works in IRDa Conn

    I Have connected IRDA in USB and Create a virtual modem com4.My work is to send message between mobile through PC and vice versa.First We work on serial cable connected with my PC and Nokia6610.But
    I face lot of Problem with AT command so I wanna be work with IRDA because All AT command work fine.
    I test it in Hyperterminal.But We will be implemented it only one way and that is comm api.But Comm api works on Serial and Parallal Port.But I create Virtual port com4.Can i do it in comm api with IRDA connection?
    I Want to know Only One Thing----------------
    Can i work IRDA with my comm API?
    (Though It is not connected with the serial port but create a virtual port com4)
    PLS & PLS Help Me Only This ANS.

    I know it's a few months later... just in case you're still wondering. Yes you can access IrDA through the Comm API check out RxTx.org they have a very active forum

  • Is IRDA Works On Comm Api

    I Have connected IRDA in USB and Create a virtual modem com4.My work is to send message between mobile through PC and vice versa.First We work on serial cable connected with my PC and Nokia6610.But
    I face lot of Problem with AT command so I wanna be work with IRDA because All AT command work fine.
    I test it in Hyperterminal.But We will be implemented it only one way and that is comm api.But Comm api works on Serial and Parallal Port.But I create Virtual port com4.Can i do it in comm api with IRDA connection?
    I Want to know Only One Thing----------------
    Can i work IRDA with my comm API?
    (Though It is not connected with the serial port but create a virtual port com4)
    PLS & PLS Help Me Only This ANS.

    yes iRDA works, I tested some of the AT+ Commands on iRDA Nokia 7110 via my laptop hope my answer does work.
    //Virtual Comm Port .. COM4
    CommPortIdentifier portID = CommPortIdentifier.getPortIdentifier("COM4");

  • Problem while sending FAX (Error Message 802 if checked in SOST)

    Hi all,
    I'm using FM SO_NEW_DOCUMENT_SEND_API1 to send Email and Fax through ABAP prog.
    The Email is going fine but there is a problem in sending Fax, when i chek in SOST i get the following message.
    Msg No <b>802</b> No delivery to 0091802299922, as recipient unknown.
    This is my Fax No. +91 91-80-2299922
    My selection screen is as follows
    Email ID : External Email id
    Fax No:  802299922 ( Passing Fax No in this format )
    Country IND
    The following is the code of my program, please show up some light on any mistake made in the same.
    *& This is my Source Code
    report z_email.
    tables : somlreci1.
    data : e_document_data like sodocchgi1,
    e_document_type like soodk-objtp value 'RAW',
    e_put_in_outbox like sonv-flag value 'X',
    e_commit_work like sonv-flag value 'X'.
    data : it_object_header type table of solisti1 with header line,
    it_object_content type table of solisti1 with header line,
    receivers type table of somlreci1 with header line.
    data : i_lines type i.
    select-options : s_mailid for somlreci1-receiver no intervals.
    parameters : p_faxno type somlreci1-fax,
    p_contry type somlreci1-country.
    start-of-selection.
    e_document_data-obj_name = 'Test'.
    e_document_data-obj_descr = 'Email Test'.
    e_document_data-obj_langu = sy-langu.
    e_document_data-proc_type = '1'.
    *--Information
    it_object_content-line = 'This is a report used to send starts and'.
    append it_object_content.
    clear it_object_content.
    it_object_content-line = ' stops to foreign distri. via E-Mail or Fax'.
    append it_object_content.
    clear it_object_content.
    *--For Doc Size
    describe table it_object_content lines i_lines.
    e_document_data-doc_size = ( i_lines - 1 ) * 255 +
    strlen( it_object_content ).
    *--Email ID
    loop at s_mailid.
    receivers-receiver = s_mailid-low.
    receivers-rec_type = 'U'.
    append receivers.
    clear : receivers.
    endloop.
    *--Fax
    if p_faxno is not initial.
    receivers-rec_type = 'F'.
    receivers-fax = p_faxno.
    receivers-country = p_contry.
    receivers-com_type = 'TELFAX'.
    append receivers.
    clear : receivers.
    endif.
    *--Call function module
    call function 'SO_NEW_DOCUMENT_SEND_API1'
    exporting
    document_data = e_document_data
    document_type = e_document_type
    put_in_outbox = e_put_in_outbox
    commit_work = e_commit_work
    IMPORTING
    SENT_TO_ALL =
    NEW_OBJECT_ID =
    tables
    OBJECT_HEADER =
    object_content = it_object_content
    CONTENTS_HEX =
    OBJECT_PARA =
    OBJECT_PARB =
    receivers = receivers
    exceptions
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    others = 8
    if sy-subrc = 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    commit work.
    wait up to 2 seconds.
    submit rsconn01 with mode = 'INT'
    with output = 'X'
    and return.
    write :/ 'Message sent successfully..!'.
    endif.
    Regards,
    Balavardhan.K

    Hi ,
    I am facing similar problem , in case you have a resolution about the FAX number , then please let me know .
    Thanks,
    Abhishek
    ([email protected])

Maybe you are looking for

  • Itunes won't start up, missing folder.

    The folder "iTunes" cannot be found or created, and is required. The default location for this folder is inside the "My Music" folder. Above is the error message I get whenever I try to open iTunes. I've tried re-installing, I've tried manually creat

  • How to upload/download file into/from blob column in ADF/JDev 11g.

    Hello to all. I found demo from Kuba user on that page: http://kuba.zilp.pl/?id=1 But that demo is for release 10g and too complicated for me for this time (I'm fish in Jdeveloper). I can create some simple table view (of form view) with oracle conne

  • Installing an application (adium x 0.89/msn) + connecting through proxy

    hi all. most .dmg files will mount and tell u to drag the .app icon into 'applications folder' may i ask, what is the difference if u drag it into MACINTOSH HDD->APPLICATIONS folder, vs dragging it into /user/applications. apparently it had an observ

  • Coding in non-latin languages

    I manage a website that is translated into 100+ languages and they keep adding more. Right now I have to add Sinhala, I have the font, but the problem is that when I copy from the PDF or Word to dreamweaver the text is converted into gibberish as I a

  • BTCare Community Newsletter Issue 4

     BTCare Community Newsletter Issue 4 Forum milestone – accepted solutions The forum’s accepted solutions feature is a great way of recognising fellow forum members for providing the answer to a problem. It also helps others find the correct answer to