I have an application that writes into serial port frequently , it works on ubuntu perfectly but on XP it doesn't write into output.
Also some where in application I try to commuicate via TCP socket, there also it doesn't send it output.
the code for writing to serial port is :
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
if (portIdentifier.isCurrentlyOwned()) {
System.out.println("Error: Port is currently in use");
} else {
try {
commPort = portIdentifier.open(this.getClass().getName(), 2000);
if (commPort instanceof SerialPort) {
SerialPort serialPort = (SerialPort) commPort;
serialPort.setSerialPortParams(57600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
out = serialPort.getOutputStream();
in = serialPort.getInputStream();
then I try out.write(bytearray);
but it doesn't send that.
Also I try the following code for socket :
skt = new Socket("10.5.0.1", 2947);
in = new BufferedReader(new InputStreamReader(skt.getInputStream()));
out = new BufferedWriter(new OutputStreamWriter(skt.getOutputStream()));
here also out.write(mystring);
is not sending.
Maybe I need to set some setting for that.
Also some where in application I try to commuicate via TCP socket, there also it doesn't send it output.
the code for writing to serial port is :
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
if (portIdentifier.isCurrentlyOwned()) {
System.out.println("Error: Port is currently in use");
} else {
try {
commPort = portIdentifier.open(this.getClass().getName(), 2000);
if (commPort instanceof SerialPort) {
SerialPort serialPort = (SerialPort) commPort;
serialPort.setSerialPortParams(57600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
out = serialPort.getOutputStream();
in = serialPort.getInputStream();
then I try out.write(bytearray);
but it doesn't send that.
Also I try the following code for socket :
skt = new Socket("10.5.0.1", 2947);
in = new BufferedReader(new InputStreamReader(skt.getInputStream()));
out = new BufferedWriter(new OutputStreamWriter(skt.getOutputStream()));
here also out.write(mystring);
is not sending.
Maybe I need to set some setting for that.