A
agloth
Hi,
I have a serial port reader application that uses datareceived event
[port_DataReceived(object, SerialDataReceivedEventArgs)] to read
incoming data. The application also send response some of the
messages.
The problem is the application sometimes behaves weird. (My
application does not respond some of the messages) And i think its
because of the threading. I know that datareceived event uses a
seperate thread. Should i use a third thread to response messages ?
If so , how can i do that. Can i use something like that ? And again
the main question is ; should i use the datareceive thread or use a
seperate thread to send messages ?
private void SendData(string data)
{
Thread dataThread = new Thread(delegate()
{
Manager.SendData(data);
});
dataThread.Start();
}
Im not good at threading so i will appreciate any help.
Regards,
Tolga
I have a serial port reader application that uses datareceived event
[port_DataReceived(object, SerialDataReceivedEventArgs)] to read
incoming data. The application also send response some of the
messages.
The problem is the application sometimes behaves weird. (My
application does not respond some of the messages) And i think its
because of the threading. I know that datareceived event uses a
seperate thread. Should i use a third thread to response messages ?
If so , how can i do that. Can i use something like that ? And again
the main question is ; should i use the datareceive thread or use a
seperate thread to send messages ?
private void SendData(string data)
{
Thread dataThread = new Thread(delegate()
{
Manager.SendData(data);
});
dataThread.Start();
}
Im not good at threading so i will appreciate any help.
Regards,
Tolga