A socket is the part of the tool that attaches to the head of a wrench or ratchet. While both are fixed in size, the spanner is the whole tool, while the socket is part of a different tool.