These are blood sucking flies. They are nasty, and don’t even spare humans.
I am sure if you check veterinary doc they would recommend you some nasty chemical to keep them away.
They smell cattle from far off kms away and keep coming back and in lots, usually start of raining season. Best and effective way to keep them away is smoke, you will have to work out a way to generate nonstop smoke. What i use to do is burn coconut husk and then add dried dung and on top of it add fresh semi solid moist cow dung only possible if your cow is naturally feed and if its Indian or semi hybrid. watery shit will not wok out.
Or you can also try to create a thick cloth bag with some sort of plastic material inside so it cannot dig its way to the udder for sucking blood, and tie this bag to the udder using a rope falling from end of backbone area. However this will not help because flies will suck blood from other parts and blood loss=milk loss. Be extremely careful these flies get pathogens from infected cattle and other sources.