Hi there,

I have wrriten a instant messaging server like MSN or ICQ and I've gotten a problem.
In theory, when client asked for sending message to a friend through that server where should I get the friend's socket?
How can I validate that socket?How can I know for sure is the specified friend socket?
What happend when the friend logged out? I should support that but I can not send messages through a broken socket(I will probably get a socket timeout error).

I think I know how to handle with online friends but on the other side, offline friends are problematic.