Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Data sent on closing the InputStream

    Hello,

    I'm integrating a Serial Device and using javax.comm.SerialPort, with java.io.InputStream and java.io.OutputStream as below :

    serialPort = (SerialPort) portId.open(name, portNumber);
    outputStream = serialPort.getOutputStream();
    inputStream = serialPort.getInputStream();
    serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);

    This was working good, but quite recently when we have a new device to be integrated, intermittently, I see an issue where when the data is written to the outputstream, is reaching the Device only when closing the InputStream.

    So the device does not respond, and when my java code times out and tries to close the connection, it starts responding.

    Very weird issue and was wondering if anyone faced such an issue.

    Note : Am using a Mac OS X 10.6 (Snow Leopard)

    cheers,
    Bob

  • #2
    New Coder
    Join Date
    Feb 2010
    Location
    Manchester, UK
    Posts
    69
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Try Flushing Output Stream. It should work properly then.
    Then get back here with news ^^


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •