Home > Back-end >  From the network card to receive data and real-time update problems
From the network card to receive data and real-time update problems

Time:09-20

Recently done a from the network packets and updates to the window on the program, now in the update to the child window have difficulty,
First of all, I like mature tools of contrast, caught the package should be not missing,
Wrapped caught the parsed to a dynamic array, and then in each child window in real time to get the final data and then update, find out of sync, I used the two methods have problems,
First, I have a packet of thread group, each listener port corresponds to a thread to get packages, deposited in the dynamic array, and then the dynamic data pointer into corresponding TLIST group, TLIST group is a critical region, with the analysis of the corresponding thread to get TLIST, that is to say, each listening ports have two threads, a package, a package and displayed, when listening to only one port, almost do not feel there is a problem, but listen to two or three ports have a problem, obviously delay and lost when display the data, and the method in more than one window display problems more clearly, the reason of my estimation is the critical area, for some window does not refresh the data, I guess this is not some threads to take data,
Second, do not set analysis thread and critical region, only caught the thread group, the packet to the dynamic data, and then in each need to update the refers to the window with TTimer component in the dynamic array data, each with the Length of the Length function to obtain the dynamic data, then take the last data, this method seems to be better (naked eye), but there is still a data update not in time,
So I want to consult a train of thought, how in multiple child Windows to update caught the packet?

CodePudding user response:

Don't know if multiple threads share data problems, try a thread-safe TThreadList,

CodePudding user response:

To use the database package (pool) technology,

CodePudding user response:

refer to the second floor lyhoo163 response:
to use the database package (pool) technology,

Could you provide some information or links to consult
  • Related