I had tried with TelnetSerialPort and jSSC library to create virtual sertial port but wont work.it not create Virtual serial port, it use existing serial port for communication.
This one my programm using jSSc library
public class VirtualSerialPort
{
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
SerialPort serialPort = new SerialPort("COM12");
try
{
System.out.println("Port opened: " + serialPort.openPort());
System.out.println("Params setted: " + serialPort.setParams(9600, 8, 1, 0));
System.out.println("\"Hello World!!!\" successfully writen to port: " + serialPort.writeBytes("Hello World!!!".getBytes()));
System.out.println("Port closed: " + serialPort.closePort());
}
catch (SerialPortException ex)
{
System.out.println(ex);
}
}
}
it gives following output
Port opened: false
jssc.SerialPortException: Port name - EMPTY; Method name - setParams(); Exception type - Port not opened.
I'm assuming you are using Windows based off the COM port identifier. In Windows you have to access COM ports that are 10 or higher with a
\\.\COMn
notation (where n is your COM port number). Try changing your code to this (note there are double the amount of\
characters to get it to show up instead of triggering an escape sequence):