I'm working in vc++.net 2003 (dll) for communicating with an device through TCP communication. My task is to send request to the device and receiving response from the device and dismandle the packets and display the data in the screen. The forms are created in vb.net 2003. The dismandled data are transferred to the front end(vb end) through a call back function.
I'm using 3 threads in my program.
1. Listener Thread for receiving packets from the device.
2. Screen Logging Thread
3. Data Logging Thread.
Listener Thread is used to get packets from the device. 3 types of packets are received.
i. Ordinary Response packet
ii. Packet for screen logging data with the service id 77.
iii. Packet for datalogging data with the service id 76.
The Listener thread checks the service id of the packet and add the packet in a list (ike linked list as a node).
Ordinary Response data are maintained in a linkedlist, screen logging data are maintained in another linked list and datalogging data are maintained in other linked list.
Now, the second thread, Screen Logging Thread,takes the first node in the linked list, process it and sends the data to the screen to refresh the screen. The device will send the screen logging packet once in a second and the screen also refreshed once in a second.
Screen Refreshing will be done in a thread Screen Logging Thread
Upto this all are working fine.
When I enable DataLogging, DataLogging data will be received by listener thread and stored in a separate linked list. The DataLogged data will come when the device buffer is full. The dataLog thread will take the node in the linked list and process it and the processed data are stored in database for later retrival.
When I start the Datalogging thread, the screen thread is not getting its chance to update the screen, and the screen is refreshed very late ( sometimes after 10 sec)
This is my problem. i tried, changing the priority of screen thread to high, but it's of no use. Same problem exists. I don't know how to solve the problem. Plz give me suggesstions.
I'm using 3 threads in my program.
1. Listener Thread for receiving packets from the device.
2. Screen Logging Thread
3. Data Logging Thread.
Listener Thread is used to get packets from the device. 3 types of packets are received.
i. Ordinary Response packet
ii. Packet for screen logging data with the service id 77.
iii. Packet for datalogging data with the service id 76.
The Listener thread checks the service id of the packet and add the packet in a list (ike linked list as a node).
Ordinary Response data are maintained in a linkedlist, screen logging data are maintained in another linked list and datalogging data are maintained in other linked list.
Now, the second thread, Screen Logging Thread,takes the first node in the linked list, process it and sends the data to the screen to refresh the screen. The device will send the screen logging packet once in a second and the screen also refreshed once in a second.
Screen Refreshing will be done in a thread Screen Logging Thread
Upto this all are working fine.
When I enable DataLogging, DataLogging data will be received by listener thread and stored in a separate linked list. The DataLogged data will come when the device buffer is full. The dataLog thread will take the node in the linked list and process it and the processed data are stored in database for later retrival.
When I start the Datalogging thread, the screen thread is not getting its chance to update the screen, and the screen is refreshed very late ( sometimes after 10 sec)
This is my problem. i tried, changing the priority of screen thread to high, but it's of no use. Same problem exists. I don't know how to solve the problem. Plz give me suggesstions.