T
T
tex6202018-06-19 15:57:48
C++ / C#
tex620, 2018-06-19 15:57:48

How to implement multithreading in the parser?

I need help, I want to make an ip address parser for availability.
I want to do work on 800 ip addresses at the same time, I decided to do it through streams, but when launched with streams, the program closes with an error:
5b28fd59a6ca9252051205.png
I understand that there is an error with vectors: and from this I have 2 questions: what is actually wrong with vectors, and how is it more correct to implement multithreading in such a task?

int k;
    for each (string ip in iplist)
    {
      threads[k] = thread(CheckPort, ip, 8080, 1);
        //CheckPort(ip, 8080, 1);
      k++;
    }
    Sleep(1000);
    for (int l = 0; l < k; l++) {threads[k].join();}
    Sleep(8000);
    k = 0;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question