We had built a Stalag Luft type hen run, half the size of a football pitch, deer fencing and festooned with barbed wire but it still didn't keep the foxes out. (It is now to become a fruit cage)
Harry, electric fencing can be effective if you have mains electricity, many of us haven't. we did try a solar powered unit but foxy jumped over it, killed all the poultry and jumped back out.
The only way I have found is to free=range my dogs along with the poultry (touching wood as I type!) and make sure they are well secured in their houses before I go home. This time of year having sheep farmers as neighbours helps as they go out shooting before lambs appear.
Years ago, when I was young, a fox was a rare visitor and you were unlucky or careless if you lost your hens to them. Nowadays well meaning but misguided folk trap foxes in towns and cities and bring them into the countryside and just let them loose. The poor beggars don't know how to hunt and are driven to desperate measures to find food. A neighbour was woken one night last year at the sound of a van, looking out she saw a Transit van in the lane, the back was opened and four foxes were turfed out. With no McDonalds or Chinese takeaway in sight what can they do? Also hand reared cubs are a bloody nuisance!! Careful as folk are to make them wary of humans it just does not work, I have had foxes approach me in broad daylight, completely unafraid.
The fact is, there are just too many foxes around but try to explain this to the townee " but foxes belong in the country, they'll be happier" people