Answer the question
In order to leave comments, you need to log in
Problem using RXTX with MOXA virtual COM port?
I'm trying to connect to Alcatel S12 PBX via Serial-port from Java application. To forward the Serial port over the Internet, MOXA software (NPort Management Suite 3.5) is used, which creates a virtual COM port on the client side. To work with the Serial port from Java SE, I use RXTX .
The problem is:
1. MOXA uses two TCP connections for data transfer: control (port 966) and data stream (port 950)
2. RXTX uses the following code to open the COM port (is it possible to open the port somehow differently, not I know):
void connect ( String portName ) throws Exception
{
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
if ( portIdentifier.isCurrentlyOwned() )
{
System.out.println("Error: Port is currently in use");
}
else
{
CommPort 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);
InputStream in = serialPort.getInputStream();
OutputStream out = serialPort.getOutputStream();
(new Thread(new SerialReader(in))).start();
(new Thread(new SerialWriter(out))).start();
}
else
{
System.out.println("Error: Only serial ports are handled by this example.");
}
}
}
Answer the question
In order to leave comments, you need to log in
Worked with NPort, but not from Java. The thing is really buggy, but I have not seen such a glitch specifically. You can try to somehow make a delay between two openings. Also for C ++ there was something like the NPort API, which allows you to work with the MOXA device directly without virtual ports, but I have not seen this for Java.
I periodically stopped opening ports in general. Deleting\adding ports in NPort Admin helped.
The NPort API is included, but for now I want to do without JNDI. Delay I will try, but most likely will not help. I went through this code under the debugger and paused for ~3 seconds
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question