.Net UDP using multithreading

I have several vehicles that send data via GPS to the server every 10 seconds, and the server must listen and decode the data for storage in the database (Sql Server). There will be hundreds of records per minute. At the moment, I have one multithreaded code that is not very useful. During the processing of one record, several records drop out. I want to create multi-threaded code so that when one thread is busy with processing, the packet moves to the next available thread.

As far as I know, after studying several forums, I realized that the "way out" will help solve this problem. But I could not find suitable examples of how income can be used?

Can someone help me with this by posting some examples?

+4
source share
1 answer

I would recommend setting up an asynchronous callback on reception, and then putting the data in the queue, from there output another line from the queue. Be sure to lock this queue, or use ConcurrentQueue to not merge the threads together.

+2
source

Source: https://habr.com/ru/post/1414941/


All Articles