My family has owned a house in Ipswich since 1948. Over the years we have advised visiting friends to wait until the Greenhead horse fly season in July is over before venturing to Crane Beach. During the summer there are even signs posted at the entrance to the parking lot stating "Greenhead Season - No Refunds."
Nothing repels these vicious biting flies except, believe it or not, Avon Skin So Soft. The down side is that this lotion will cook your skin to a crisp in the hot July sun even with sunblock. Just make sure you cover every inch of exposed skin because the Greenheads will find the one spot you miss. I speak from experience.
Late August and early September are the best times to visit Crane Beach. The water temperature is as warm as it gets all year and the biting insects are gone. There is also an annual sandcastle building contest in August that draws huge crowds, so plan accordingly. The beach website lists the specific dates each year.