Receiving messages part by part from serial port using c#
- by karthik
I am using the below code to receive the messages from serial port using c#
void comPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
if (comPort.IsOpen == true)
{
string msg = comPort.ReadExisting();
MessageBox.Show(msg.Trim());
}
}
The problem is, i am getting the messages part by part. Like, if u send "Hello, How are you"
I am receiving it word by word. I want that in a single stretch. How can i do ??
Also, is it possible to retrieve the port name from which the application is sending and receiving messages ?