Friday, August 14, 2009

Global Text Chat Room Application using C#.Net Programming - Remoting technology 6/6



ß Read Previous

Leave the Chat Room:
When user closes the chat room, then client application request to server to remove his/her name from server’s online user list. In client side the below method invokes –
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
if (remoteObj != null)
{
remoteObj.LeaveChatRoom(yourName);
txtChatHere.Text = "";
}
Application.Exit();
}
In server side the “LeaveChatRoom()”method invokes, the code of that method is –
public void LeaveChatRoom(string name)
{
alOnlineUser.Remove(name);
SendMsgToSvr(name + " has left the chat room.");
}
Now server has deleted your name from online user list.

No comments: