I'm looking for help in figuring out how to look up ports in my program. What I want to do is search for ports that already have devices connected to the computer, and then assign those within the program.
The way it works right now is that I have to manually assign the ports used in the console. I want the program to look up a string that the device is currently sending to the computer, the code will recognize that string and realize what port it's coming from, then set the device to that port automatically.
Does anyone have any suggestions as to how I should go about writing code to search for ports in use and assigning them?
(I'm slightly new to programming, so any help at all is appreciated.)