Sayyiduna Sahl bin Hunayf (may Allah be pleased with him) narrates from the Prophet (peace and blessings be upon him) that once, while the Messenger of Allah (peace and blessings be upon him) was in his chamber, a man began peeping through a crack in the house. He (peace and blessings be upon him) saw him, and at that time he (peace and blessings be upon him) had a comb with him, and he (peace and blessings be upon him) said: "Had I known that you were waiting for me (peeping), I would have got up and thrust this (comb) into your eyes. The command to seek permission has been given only to restrain the gaze (from looking where it should not)."
Hadith Referenceالمعجم الكبير للطبراني / باب السين / 5564