Each program that sends packets more then likely has a predefined structure, so you could read first few bytes of packet and get most likely program.
Also if you check the port that could be more helpful as there uassly unique.
Another would be check destination ip. Have a list you check against(somthing like this).
Read in whole file when app starts. Use , as delimiter and read in vars to check against and : to read in name of app. There is nice containers you could use to link vars to name. Or just recursively search each line till match found or EOF.