Rather than building & hosting a chatting app, you can
utilize the Google Talk Gadget or Windows Live Messenger IM Control to leverage their infrastructure & ready made solution.
The Google Talk Gadget lets you
see your contacts and chat with friends right on your homepage, and it
doesn't require a download - http://code.google.com/apis/talk/talk_gadget.html
You can add the Google Talk Gadget to
your own webpage or blog by pasting a single line of code into your
site -
http://www.gmodules.com/ig/creator?synd=open&url=http%3A//www.google.com/ig/modules/googletalk.xml&pt=&context=b&synd=open&lang=en&.lang=en&country=us&.country=us&cat=all&num=24&start=0&cols=4&objs=w,mO,jyq,gQq,jhP,NL,Hg,pV,RB,p,33G,EKT,6aZ,7Wu,aag,2C,vB,sMg,j0,xQO,5WIK,Rm,gP1,acyU&sn=2C&lang=en
The Windows Live Messenger IM Control enables Web sites to show the presence of Windows Live Messenger users, and lets site visitors engage in instant messaging conversations with these Live Messenger users. A Web site can invite its users to share their Live Messenger presence and exchange messages with visitors to the site - http://msdn.microsoft.com/en-us/library/bb936682.aspx
The
Windows Live Messenger Library is a client-side Javascript library that
enables third-party sites to seamlessly add instant messaging
capabilities with Windows Live Messenger -
http://dev.live.com/Messenger/
If you still wish to build your own app, take a look at this open source software on CodePlex - http://www.codeplex.com/LiveChatStarterKit
or
check this article on building a simple Chat system - http://steveorr.net/articles/WebChat.aspx