Loneliness most difficult illness to handle. I have seen people, desperate to meet people, have a chat, touch them and just feel like being with somebody. Especially at older age this problem becomes more apparent, body start showing it's resignation, young lot (if around) busy with their life. With their fast pace and demanding schedule finding time for old lonely person is difficult and nobody prefer to listen after hectic day at work. Everybody wants unwind, relax for next grueling day.
For some people they feel they are alone in pack. Most of the time we are in pack because of some undue circumstances, be it a job or a family/friends. We just hang around because there is no better place other than pack. But deep inside these people have nervous feeling of loneliness. During that state no matter what you do won't help, you won't able to concentrate or do any fruitful activities.
So from old to young, everybody faces problem of loneliness. If this is the case, think about what will be case of person who is in solitary confinement? Sitting alone 24 x 7 is the harshest punishment any one can get. So how do we cope with this kind of situation.
To me active mind is most important in this situation. If you observe some of great political prisoners, they have written remarkable books. Even though their body was confined mind was working on their goal. Similarly even if we are lonely by any circumstances, if our mind is working on ultimate goal, we won't feel lonely.