Genuine loneliness, like what you described, can only really be solved by touching grass. Figure out your hobbies, or find one if you don't have any.
My answer to what a lot of people call "the male loneliness epidemic" as a woman is to say it doesn't exist, you need to figure out how to be attractive. We aren't throwing ourselves on shitty men, and most of the men that complain are complaining because they feel entitled to us and thus put no effort into being attractive. The quickest way to be attractive is have empathy and not be a douche. Listen to peoples needs, and don't feel entitled to our attention