You havnt been able to explain your question well ... but if you are planning to make a messenger like msn or yahoo ... you'll have one server running at all times .... and then when the user signs in ... it'll request the server ... and the server will determine who in his buddy list is active and who is not....
If you are planning a lan messenger .. then its so easy ... study the basic networking concepts of java and you'll be on a flying start on your messenger. If you have any probs ... post them here ... you'll be helped.