Measuring the pipe
For a socket (the part slides over the pipe) the pipe's outer diameter counts, for a spigot (the part goes into the pipe or hose) its inner diameter. Measure with calipers at several points and use the average – plastic pipes are often slightly oval.
Without calipers: measure the circumference with a tape measure or a strip of paper and divide by π (3.14). The pipe presets fill in standardised sizes such as HT or KG drain pipes automatically.