Everyone has times of feeling lonely at university, even (especially?) the people who go out all the time and appear very outwardly confident. It takes a while to make good friendships where you can be honest about how you feel, so you spend a lot of time putting on a front of being happy because you don't want to admit weakness or moan to people you've just met. There's a lot of down time and it's important to keep yourself busy. But times of feeling lonely can make you appreciate the friends you have - both those at home and the new ones you've made.