When you get the Disconnected
event, the TerminalControl
is unbound from the underlying channel. If you want to reconnect, you have to bind the terminal again, like this:
var serialPort = new SerialPortChannel("COM1");
terminal.Bind(serialPort);
This will create new serial port channel and start processing data.
Can you please add communication logging to the serial port channel and send us the log to support@rebex.net for analysis? Also please log the Disconnected
event. Use the logger for all SerialPortChannel
instances.
It can be done like this:
var logger = new Rebex.FileLogWriter(@"c:\data\terminal.log", Rebex.LogLevel.Verbose);
var serialPort = new SerialPortChannel("COM1");
serialPort.LogWriter = logger;
terminal.Disconnected += (s, e) =>
{
logger.Write(LogLevel.Info, null, 0, "INFO", "Terminal Disconnected.");
};
terminal.Bind(serialPort);