A good example that explains the exact relationship between "communism" and "socialism" would be to examine the two terms "Catholic" and "Christian". Obviously, though they share a relationship, they are not interchangeable. You could for example, say that the Pope is a "Christian". But you could not say that Billy Graham is a "Catholic".
Basically the difference is this:
SOCIALISM - From each according to his ability, to each according to his deeds.
COMMUNISM - From each according to his abiliy, to each according to his needs.