0

I have written a code for serial communication using RXTX comm.When i write 13000 bytes on port then nothing is written but when i write 115200 or less bytes it works like a charm.One more thing this only happens on some systems.

Update: Below is my code that write bytes on port:

public String portWriter(byte[] messageString) throws NoSuchPortException {
        if (Processing.serialPort == null) {
        System.out.println("serial port is null");
        Processing.portId = CommPortIdentifier.getPortIdentifier(Processing.portText);
  try {
        Processing.serialPort = (SerialPort)   Processing.portId.open("SimpleWriteApp", 2000);
        } catch (PortInUseException e) {
            return "Port in use by another application.";
        }
        try {
            Processing.serialPort.setSerialPortParams(Processing.speed,
                    SerialPort.DATABITS_8,
                    SerialPort.STOPBITS_1,
                    SerialPort.PARITY_NONE);

        } catch (UnsupportedCommOperationException e) {
            return "Unsupported comm operation.";
        }
    }
    try {
        outputStream = Processing.serialPort.getOutputStream();
        outputStream.flush();
    } catch (IOException e) {
        return "Unable to write on port.";
    }


    try {
        //System.out.println("write " + new BigInteger(1, messageString).toString(16));
        outputStream.write(messageString);
    } catch (IOException e) {
        return "Unable to write on port.";
    }

    return null;
}

0 Answers0