Delphi-Kylix
  Home arrow Delphi-Kylix arrow Page 4 - Server Side Chat Application with Borland ...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DELPHI-KYLIX

Server Side Chat Application with Borland Delphi/Indy, concluded
By: Jacques Noah
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2006-01-02

    Table of Contents:
  • Server Side Chat Application with Borland Delphi/Indy, concluded
  • Code for connecting clients
  • The heart of the application
  • Code for leaving a chat

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Server Side Chat Application with Borland Delphi/Indy, concluded - Code for leaving a chat


    (Page 4 of 4 )

    The next bit of code deals with what happens when a client leaves the chat. Go to the object inspector, double click on OnDisconnect and add the code below:

    procedure TForm1.tsDisconnect(AContext: TIdContext);
    begin
    //inform everybody that the client left the chat
    TLog.AddMsg(TMyContext(AContext).Nick + ' Left the chat');
    tmycontext(acontext).broadcastMsg(tmycontext(acontext).Nick + ' Left the chat');
    end;

    This last bit disconnects the server. Click anywhere on the form, go to the object inspector events tab, double click on Onclosequery and add the following code:

    procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
    ts.Active:=false;
    end;

    Finally

    Remember to add the following to the forms’ uses clause right at the top of the form but below ‘interface’: idcontext, idsync, idstreamvcl. Also, I’m using Indy version 10.0.52, so these units may not be available if you are using an older version, so try to update your Indy version.

    Copy and paste both the code from the previous tutorial and this one, on one form in the order that I’ve shown them, and you should be ready to go.

    That’s it! Now you have a fully functioning chat server. Next we are going to develop a client application that will allow people to connect to your server and chat! So stay tuned.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · We hope you found this article educational and useful. Please feel free to let the...
       · i downloaded the code, but when i try to compile with delphi7/indy10, i get ...
       · Please sent me your email address and will sent you the latest source code. From the...
       · thanks for your concern. I don't know how else to send it, but to post it here ......
       · sure, kwanbis at gmail dot com ... can you send me client and server code? thanks a...
       · Somehow the source is looking for TPopUpActionBarEx and TIDStreamVCL. What are...
       · I am getting the same errors as the 1st post has in it from Anon Loozah. I am...
       · Delphi 7 enterprise indy 10.0.52.1st problem:When I compile client project I...
       · Can I get the latest source code as well. email: ryann@stonegolemgames.com. Or is...
       · Delphi 7 enterprise indy 10.0.52. 1st problem: When I compile client project I...
     

    DELPHI-KYLIX ARTICLES

    - Delphi Wrapper Classes and XML
    - Delphi and the DOM
    - Delphi and XML
    - Internet Access: Client Service
    - Finishing the Client for an Internet Access ...
    - The Client for an Internet Access Control Ap...
    - User Management for an Internet Access Contr...
    - Important Procedures for an Internet Access ...
    - Server Code for an Internet Access Control A...
    - Constructing the Interface for an Internet A...
    - Building a Server Application for an Interne...
    - Building an Internet Access Control Applicat...
    - Client Dataset: Working with Data Packets an...
    - Using the Client Dataset in an N-Tiered Appl...
    - Using the Client Dataset in Two-Tiered Clien...






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT