On 32-bit WinXP -- Is it possible to have two COM ports directly connect to each other and transfer data? I have a USB to Serial dongle linked to another USB to serial dongle linked with a Null Modem. Using the Java RXTX library I am able to detect the COM port on each computer so I know that works OK. Can I send data directly to the other serial port through this setup and utilizing this library?
From Computer A / COM1:
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM1");
CommPort commPort = portIdentifier.open("serial1",2000);
SerialPort serialPort = (SerialPort) commPort;
serialPort.setSerialPortParams(9600,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
InputStream in = serialPort.getInputStream();
OutputStream out = serialPort.getOutputStream();
I don't seem to be able to access computer B COM2 port via this mechanism. Are there other constructs that I should be using here?
I would like it so that computer B could read from the stream as I wrote to it on Computer A.
One thing you could try to confirm that it's nothing with the RXTX library, or your cable/adapter, you could open up a hyperterminal session at each computer, configure equal serial port parameters, and start typing in one of them - the text should appear in the other, and vice versa. If you have that working, then it's just a problem with the code.
I found this good example. You could take out the writing part and put that at one computer, and the reading part and put it in the other.