Java and communication port

Hi all
I want to know if java can communicate with a device , for example a TPE (Terminal de Paiement Electronique), via the PC communication port . I want to send and receive informations between a java stored procedure and the TPE.
Thank you very much indeed.

In case if you find any Win32 Calls or C++ calls which accomplish your requirement, You might write an JNI wrapper over it and use those java APIs.
-Suria

Similar Messages

  • Java and parallel port

    I don't know if this is forum I should ask this question but I didn't find any corresponding
    to java and ports control.
    I'm using Aurox 11.0 linux.
    I wonder if I could control each output (DATA pin) of parallel port separately in
    Java Communications API?. I can control outputs in Java with JNI but I need to run
    program as root. If I would want to create applet which would use parallel port
    I would have to create server with which this applet would communicate (Limitations of
    applets). But this server would have to run as root. It would affect security of system.

    Because of C++ ioperm function. This function requires root privileges. I have JNI Java
    program which can control outputs of parallel port on the level of one byte (write
    whole byte - all DATA outputs) and C++ program which can control outputs of port separately (control of each pin) and both are based on ioperm function. Both require
    root privileges. So my question is: can I control each output pin separately with Java Communications API?. Maybe if I used wholly Java code I could access port with user privileges?.

  • Java and serial port communication

    Hello,
    In my code i have parsed a file through which i have extracted the port name and baud rate .
    Now i want to open the port with this portname and baud rate.
    I have a device moxa card which has 16 port and want to open each and and read and write data into it.
    thanking you.

    RXTX seems to be a decent library for serial/parallel communication using Java.
    [http://www.rxtx.org/]

  • Java and serial ports

    i want to be able to use java to access my serial port to
    remote dial other systems....

    Download javax.comm from the Sun website and use that.
    http://java.sun.com/products/javacomm/index.html
    Follow the install instructions VERY carefully .

  • How to add control buttons using Java thorugh serial port?

    Hi everyone,
    I'm new to this forum.
    I have some questions on Java and serial port.
    I want to write a Java program to control my robot, through serial port. For example, when I click "Forward", the robot will go forward, and so on.
    Now I already have the buttons, so next I would like to ask how to interface the buttons with the serial port.
    I already have all the javax.comm things installed.
    below is the code for my buttons:
    import java.awt.*;
    public class ControlButtons extends java.applet.Applet
         GridLayout myLayout = new GridLayout(3, 3);
         Button button1 = new Button(" ");
         Button buttonForward = new Button("Forward");
         Button button2 = new Button(" ");
         Button buttonLeft = new Button("Left");
         Button buttonStop = new Button("Stop");
         Button buttonRight = new Button("Right");
         Button button3 = new Button(" ");
         Button buttonReverse = new Button("Reverse");
         Button button4 = new Button(" ");
         public void init()
              setLayout(myLayout);
              add(button1);
              button1.setVisible(false);
              add(buttonForward);
              add(button2);
              button2.setVisible(false);
              add(buttonLeft);
              add(buttonStop);
              add(buttonRight);
              add(button3);
              button3.setVisible(false);
              add(buttonReverse);
              add(button4);
              button4.setVisible(false);
    }Now I would like to ask for direction on how to add in the code to make it work with serial port.
    Thanks

    The plan is, I have a robot device connected to the serial port.We don't know anything about that device. We don't know how to control it. We don't know what you have to write to the device to make it do anything. Only you know what.
    For example, when I click "Forward", the robot will go forward, and so on.So what do you have to send to make it do that? and same for the other buttons.
    Next, you need to work out from the javax.comm API how to open the serial port and send data to it. This is a standard exercise in learning a new API. You must be able to do this. Again and again.
    But the program is useless. The button can be clicked, but didn't do anything.Because (a) they have no ActionListeners and (b) there is no code to send anything to the serial port.
    You have to write all that. So you also have to look up ActionListener in the Java API and how to attach it to a button. You can do that. We all do that kind of thing every day.
    So next I would like to ask how to interface the buttons with the serial port.You've been asking nothing else since you started, but you've also only done enough investigation of your own to create the buttons. That's only the start.
    The problem is what method and command should I use to make those buttons actually functioning.See above. You've been told part of it several times. The rest only you can answer, because it's your robot.

  • I just ran a software update for Java and MacBook Pro SMC, now my Mini Display Port to HDMI TV is not working. The TV is flickering. The Mac Display is fine.

    I was just watching / streaming TV off Safari on my actual TV.
    I'm using a Mini-Display Port to HDMI cable for the connection to the external display.
    Software update popped-up and said there was an update for Java and for SMC.
    I ran the update and upon the computer restarting, my external display (my TV) is no longer working. It is now flickering.
    It won't work in Mirroring or set up as an extended display.
    I've reset SMC / PRAM / Safe Mode / Even restored from a Time Machine backup (From before the updates were done).
    What could it be?!

    I keep saying this over and over, in the hope that people who do a search will find it.  Apple cannot possibly test for or be reponsible for the bazillion combinations of adapter, cables, and TV's out there.  The only monitors that are 100% guaranteed to work with the MacBook Pro are the Cinema Displays and Thunderbolt Displays, because, they're made by Apple.  They're expensive, but they work perfectly.
    My guess is that you bought a cheap MDP to HDMI cable, or have a defective one.  From my reading of these boards over the past few months, cheap cables have a high failure rate.  And the regular priced ones have only a slightly less of one.  Try a new one.  Make sure you do not damage the Thunderbolt port.

  • Data conversion for communication between Java and C/C++ program

    The real problem, i guess, is about data type conversion between Java and C programs. For instance, and int is supposed to be 4 bytes in Java, and also in C/C++. But, as far as I know, the size of and int in C depends on the processors architecture, so if it were a 64 bit arch., size of and int, double, etc. in C, would change. The real scenario would be a communication between a 32 bit machine (Java) and a 64 bit machine (C/C++).
    First of all, is this assumption correct?
    If so,
    how is it possible to deal with this problem in Java?
    Is there any way to know 'type length' automatically? or
    would it be necessary to modify the Java program to work with a C program in 32-bit or 64-bit arch?
    thx in advance

    cotton.m wrote:
    Yes you should develop the C part of the protocol first and then build from there.
    See http://forum.java.sun.com/thread.jspa?threadID=5243547 for a previous discussion of this topic.
    I understand what you mean, also the topic you referenced. I will explain the situation a bit more. The protocol is already defined: (16 bits message size, 16 message id, 32 bit time, etc.); it is also defined in C (structures and so on). So it would be easy to write my Java code using the specified protocol in bytes, and C types wouldn't be necessary to be considered. But, let's say that the C code can't be modified, and I thought (and don't know yet if its correct), that size of C types CAN changed depending on architecture. So if size changes for C types (code is specified in short, int, etc, and not in bit format), it all would be a mess, if I don't implement something in my Java code.
    cotton.m wrote:
    I don't believe that 32 or 64 bit enters the equation here at all.Maybe 32 o 64 doesn't mind, but sparc or PC could take a point here. Communication would be between a sun solaris sparc and windows x86 PC. But if type size in C/C++ does not change, I wouldn't really have any problem then...
    The situation is not ideal, I know, but is what I have; and I think I could have problems if I run the C program in other machines; so I would have to try to solve it whithin my Java Program.
    I hope it is clear now what I need.
    thx
    Edited by: MGasa on Jan 16, 2008 1:51 AM

  • Communication between java and c++, help!

    i am c++ programmer and newly to java.
    now i am developping a client/server app. i use java transfers data (socket) between client and server, and use c++ to create user interfaces because c++ is easier for interfaces.
    my question is:
    in a single PC, java needs to tell c++ what info was read from socket and c++ needs to tell java what info will be written to socket.
    i want to use 2 files (read and write) as media between java and c++. that is: java writes data to a file and c++ reads from the file, and vice versa.
    i know it's not efficient. could you tell me better way to do?
    thanks in advance.

    thanks for reply.
    my problem is: socket is fare in java, not fare in c++
    (win/nt). could u use server in a non nt-server
    machine with c++?I'm not sure what you mean "fair". NT-Server is just a version of NT that Microsoft adds their server products to. Most of which you don't want to use because they are a security nightmare. I think what your asking is can you do the equivalent of Java's ServerSocket in C++. Sure, the socket libraries in Windows (at least last time I checked) were based off the BSD socket libraries. So you would basically do something like:
    // Open socket
    ss=socket(AF_INET, SOCK_STREAM, 0);
    if(ss==-1)
      cerr<<"Error opening socket."<<endl;
      return 0;
    // Fill in address
    struct sockaddr_in server;
    server.sin_family=AF_INET;
    server.sin_port=htons((unsigned short)port);
    server.sin_addr.s_addr=INADDR_ANY;
    // Bind to port
    if(bind(ss, (struct sockaddr *)&server, sizeof(server))==-1)
      cerr<<"Could not bind to port "<<port<<"."<<endl;
      return 0;
    // Ready to accept connections
    if(listen(ss, 5)==-1)
      cerr<<"Could not listen."<<endl;
      return 0;
    // Loop to accept connections
    while(/* some condition */)
      // Accept a connection
      int s=accept(ss, 0, 0);
    }This should work on any version of windows as long as you have winsock. The example code might need to be changed a little though since I copied it from a Linux program I had.

  • Communication between Abap and Java and Java to Abap

    HI,
    I have installed BI 7.0 and the user complaints that BEx WEB Application Designer Query results are not showing up in the WEB URL Link.
    and the BI user suggests that communication between Abap to java and Java to Abap has to be done?
    How to setup ABAP to JAVA and JAVA to ABAP communication?
    Regards,
    Magham.

    Hi,
    Jco conn from ABAP to Java
    =====================
    You can use the JCO RFC Provider Service of the Web Application Server for your ABAP to Java calls.
    The steps involved in that are
    1. Configure destination in SM59 in SAP.
    2. Create RFC Destination in Visual Admin.
    3. Create a stateless session bean with JNDI name as the name of calling function module in SAP.
    4. Add a business method public void processFunction(JCO.Funtion fn) which is called by the JCO RFC Provider Service. The name should be 'processFunction'.
    5. Set library references in application-j2ee-engine.xml to type weak for the following
    a. com.sap.mw.jco.
    b. com.sap.tc.Logging (if you are using the logging api )
    Here is the sample code for the EJB biz method
    Business Method.
    public void processFunction(JCO.Function function) {
    try {
    // Get the import parameters for the function module
    JCO.ParameterList importList = function.getImportParameterList();
    logger.infoT("The value sent is" +
    (String)importList.getValue("USER_NAME"));
    // Set the export parameter value for the function module
    JCO.ParameterList export = function.getExportParameterList();
    export.setValue("From EJB", "RETURN");
    function.setExportParameterList(export);
    catch (java.lang.Exception e) {
    e.printStackTrace();
    Jco conn from Java to others(ex:ABAP)
    =====================-==========
    • Open Visual Admin(C:\usr\sap\SID\JCxx\j2ee\admin\go.bat) and connect to server
    • Go to Destinations service
    • Open HTTP Settings Tab
    • Add/Edit destination SLD_DataSupplier and type following values
    URL – http://xyz.corp:53000
    Authentication - BASIC
    User – dynproxxx
    Password - bp52st000
    • Press save and test (if you get response code 200 everything is o.k.)
    • Add/Edit other HTTP Destination named SLD_Client with the same values as SLD_DataSupplier:
    URL – http://xyz.corp:53000
    Authentication - BASIC
    User – dynproxxx
    Password - bp52st000
    • Press save and test (if you get response code 200 everything is o.k.)
    • Go to SLD Data Supplier service.
    • Press the button named: Send the Data to SLD and confirm triggering SLD Data transfer (if you receive successful message everything is o.k.).
    ===================
    following blog might helpfull
    =======================
    /people/michal.krawczyk2/blog/2005/03/10/registering-a-new-technical-system-in-sld--abap-based
    for basic infor
    ==============
    http://help.sap.com/saphelp_nw04s/helpdata/en/21/84570b3ae14e77b3047c82218974b9/frameset.htm
    Award points if it helps

  • GPIB and serial port communication errors via an executalbe file.

    I have a data acquisition program that communicates with instruments via the serial port and GPIB bus. When I create an executable file and run it on another PC I get GPIB and serial port errors when the program tries to initialize these ports. Are there additional vi's I need to include when I build the executable?

    When you installed the GPIB board on the other pc, did you install just NI-GPIB? Did you configure the GPIB board? You also need NI-VISA if your're using VISA calls in your program. You can either install the full NI-VISA or just the run-time version.

  • One socket and two ports, not getting response from the server

    Hi everyone,
    I am working on device which communicate through Tcp sockets, It has an IP address and one port for listening and another for sending the response.
    Problem is that I am able to create a connection to Device ip+port, and i am trying to listen on the same port while the device is sending the response on other port. My problem is that i can't create another socket using this port and therefore not getting the response from the device.
    Can you people tell me how to handle such socket communication in java ?
    Thanks in advance.

    I am working on device which communicate through Tcp sockets, It has an IP address and one port for listening and another for sending the response.Are you sure? That's not usual. It would be usual for it to use the same port for listening, reading, and writing.
    Problem is that I am able to create a connection to Device ip+port, and i am trying to listen on the same port while the device is sending the response on other port.I would try just reading from the same socket you are sending on. I suggest you have misunderstood how the device works.

  • Use of synchronized queue for java socket communications

    Hi all,
    We have a need for a server socket application (stand alone java application) to process just one command per time coming from a java socket client (JSP Web application). There are a lot of users accessing the java socket client, but the server socket can only handle one command per time, so there is a need of a queue type, so users will have to wait for their time.
    We've been told that we can use "synchronized Queue", but we don't know what it is and how to use. A URL, book etc. with sample code would assist us, since we are new to both java socket communication and queue of commands.
    Can anyone assist us
    cheers
    Trajano
    P.S.
    The server socket java application has two threads:
    1st thread handles the java socket communication;
    2nd thread is a RS-232 serial driver that communicates to several micro-controllers connected on a multi-drop.
    JSP web app client socket users can issue various commands at the same time to the java server socket app, however the server can only service one command per time (just one RS-232 COM1 serial port available). The commands have to somehow be added to a queue for processing.

    I do not have the experience to offer advice. But I just happened to be reading today about Collections.synchronizedList.
    import java.util.List;
    import java.util.LinkedList;
    import java.util.Collections;
    public class Queue {
       private List queue;
       public Queue() {
          queue = Collections.synchronizedList(new LinkedList());
       public Object removeItem() throws InterruptedException {
          synchronized (queue) {
             while (queue.isEmpty())
                queue.wait();
             return queue.remove(0);
       public void addItem(Object item) {
          synchronized (queue) {
             queue.add(item);
             queue.notifyAll();
    class Test {
       public static void main(String[] args) {
          final Queue queue = new Queue();
          //start a thread to process items from the queue
          Runnable work = new Runnable() {
             public void run() {
                try {
                   Object item = queue.removeItem();
                   //do something with item
                } catch (InterruptedException e) {
                   //handle this
          Thread worker = new Thread(work);
          worker.start();
    }Reference: Java Thread Programming, Paule Hyde
    Also, here is Doug Lea's library,
    http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html

  • Diff between the J2ee port,webdispatcher port and ICM port

    HI All,
    Can some one please explain the diff between the web dispatcher port and J2ee port, I am able to under stand the diff between the web dispatcher port and the ICM port. What I understood is that all the requests will be passed to ICM through the web dispatcher , but what is the j2ee port refers ?
    Thanks & Regard
    Rajesh Meda

    Hi Rajesh,
    The Webdispatcher,ICM servers as services to reach the ABAP and Java stack respectively. ICM is thread oriented.
    Any communication flows through Webdispatcher ---> ICM ---> ABAP/Java Stack.
    Every instance has a ICM process in it. Webdispatcher is mainly used for load balancing and to be placed in DMZ zone for more protection of the communication channel. All the communication happens via port . Each of the service can be reached by independent ports or via Webdispatcher>ICM> J2ee.
    Like direct port for J2ee we also have direct port for ABAP message server.
    Hope this clarrifies. Kindly let me know in case of further queries.

  • Problem with java and flex web service

    Hi,
    I have a basic web service written in java using jax ws 2.1
    ri. I need to call it from Flex using the WebService class
    Annotations for the java web method :
    @WebMethod
    public void Login(
    @WebParam(name="server") String serverURL,
    @WebParam(name=AUTHENTICATE_HEADER,header=true,mode=WebParam.Mode.INOUTHolder<Authenticate Header>
    authHeader)
    When I try and call the service from Flex , it can't find the
    login method and attempts to call it fail. If I set the web service
    to RPC based using @SOAPBinding , the method is found but then
    there are issues with the authentication header.
    What do I need to do to get flex web services communicating
    succesfully with java ?
    Are there are any known compatibility issues ? Or guidelines
    for going about this ?
    Any help would be appreciated

    well Shay,
    i've used JDev's tools to developer and to deploy the web service: the war and ear files are automatically generates you to the end of the process.
    I have included all the files java and the compiled classes, but I do not have files jar.
    But don't works: if i create only one java class with all code inside then it works fine!!
    Daniele

  • RE: Java and Forte

    We have no problem using JDK 1.1.5. However, we are using Orbixweb. If
    you are accessing the applet and the IOR file from the same host (exact
    host name), then one other possibility is the JVM compatibility for your
    browser. Using Javasoft's Activator or appletviewer should resolve
    that.
    -----Original Message-----
    From: Kamran Amin [SMTP:[email protected]]
    Sent: Tuesday, March 10, 1998 7:48 AM
    To: '[email protected]'; '[email protected]'
    Subject: RE: Java and Forte
    Dan,
    We had the same problem as you are having regarding question
    one. Make
    sure you are
    using JDK 1.1.3 or 1.1.4. It did not work for me when I was using JDK
    1.1.5. Also you have to
    use the gatekeeper to make the applet work. Hope this help.
    Kamran Amin
    Forte Technical Leader, Software Engineering
    [email protected]
    203-459-7362
    Oxford Health Plans
    48 Monroe Turnpike
    CT, Trumbull 06611
    http://www.oxhp.com/
    From: [email protected][SMTP:[email protected]]
    Sent: Monday, March 09, 1998 7:49 PM
    To: [email protected]
    Subject: Re: Java and Forte
    1. I have been able to make my Java client appllication call-in to a
    Forte service object with success. However the tricky part beginswhen
    I try to do the same with a Java applet. I get an exception returned
    which is an AppletSecurityException. I understand that running a Java
    applet in a browser has two limitations, one being the Java applet
    sandbox and the firewall restriction. As I am only running my Java
    applet and the Forte service object on the same node, this rules out
    the latter.
    I have tried running the Gatekeeper from the same directory as myJava
    client application, which includes all the client stub files
    (including stub files which are generated from Forte supplier plans
    such as those in the Framework folder). However, I still receive the
    AppletSecurityException.
    How can I go about making this operation successful?
    **AppletSecurityExceptions can be caused by many problems--trying toaccess
    machines other than the class download machine, or trying to accessserver
    side classes outside the defined directory structure in the webserver. I'd
    look closely at the classes that are being brought into memory (forexample,
    Visibroker's ORB shows you each file as it is loaded) and make sureyour web
    server is defined correctly. If you follow the Forte technotesclosely, it
    usually solves this problem.
    2. Has anyone tried implementing a 'fat' client, one that combines a
    Forte web application, JavaScript, and a Java applet client toperform
    operations such as validation and a tiny bit of data processing allon
    the client side, relieveing the application server from such
    operations? If yes, how do I implement the solution, and are thereany
    tech notes from Forte that specifically tell me how to do this?
    **We have created a Java framework that follows many of the designpatterns
    and naming conventions as our Forte framework. The Java classes canbe
    extended to marshal and unmarshal scalar data structs passed acrossthe ORB
    boundary to instantiate 'thick' functional objects on the client, andas much
    processing and as many business rules as wanted can be developed inthe
    client
    Java objects.

    If you look at the exception information in the iiop manual it
    discusses exteneded propties DefaultThrowsClause, ThrowsClause and
    IsThrowable.
    If you mark your exception class with IsThrowable it will show up in the
    IDL as an exception. If you use either DefaultThrowsClause(project) or
    ThrowsClause(method) you will get the appropriate raises in the idl.
    This will cause the idl2java to produce code which will allow you to catch
    the exception.
    Tom.
    At 09:41 AM 1/29/99 +0100, Giuseppe Sorce wrote:
    >
    Hi all,
    I am currently working to an architecture to establish a communication
    between a Forte' server and a Java client, using Visigenic's Visibroker and
    IDL mode.
    I have problems when I try to raise a Forte' exception from a method
    invoked by the Java client; I would like the exception class
    (ProductException) not to inherit from the class GenericException, because
    the IDL I want to generate must have this structure:
    exception ProductException {
    string message;
    Using this solution, the client application gets blocked waiting forever.
    I am currently working with:
    - Forte' 3.0.G.2 plus WebEnterprise 1.0.B
    - JDK 1.1.5
    - Visibroker 3.1
    My question is: is it possible to raise an exception from the Forte' side
    that is
    compliant to the IDL mentioned above?
    Of course it should be caught from the Java side.
    Thank you in advance
    Giuseppe Sorce
    CSI Piemonte - C.so Unione Sovietica 216 - 10134 Torino - ITALY
    tel. +39-011-3168736
    fax +39-011-3168212
    e-mail [email protected]
    url http://www.csi.it
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

Maybe you are looking for