What does a cock ring do?

I remember one of the first guys I had sex with would wear a cock ring, I always though it was because he had a hard time getting hard and I thought it helped it... is that what it's for? Does your man use one?