How can I find a working ip and port

My goal is to find the working ip and port
When I press the SELLECT FILE button, it will read the txt file line by line and transfer it to listview1.
When I press the start button, it will try all the lines in listview1 and if the ip and port in the line is working, it will add the working ip and port to listview2.
This process should continue until listview1 is finished, and the ip and ports that are not working should not be added to listview2.
When I press the Save button, a new txt file should be created and listview2 data should be added to this file.
Textbox to specify the name of the txt file.
Pressing the Stop button should stop the process.

Help me with this project, I don’t know how to do it

İp and port example

Blocks and design