Delphi-Kylix
  Home arrow Delphi-Kylix arrow 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  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
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


    (Page 1 of 4 )

    This article picks up where last week's article on building a server side chat application left off. By the time you reach the end, you should have a fully functioning chat server.


    A downloadable zip of the COMPLETE source code for the application is available

    here.

    Introduction

    In this part we are going to finish off the server side coding of our Chat Application. In the previous part - Server Side Chat Application with Borland Delphi/Indy - we discussed how the server actually carries out all its communication functions as well as how it interacts with the client application. We also defined and implemented all of the procedures and commands needed to run our custom communication protocol.

    Let’s continue…

    I’m not going to go in detail about how the code works, however, I will make sure to comment the code heavily, so that it makes sense when you read it.

    Add the following three procedures in the implementation section:

    procedure TLog.DoSynchronize;
        begin
         form1.Memo1.Lines.Add(FMsg);
       
        end;
        class procedure TLog.AddMsg(const AMsg: String);
        begin
            with Create(AMsg) do try
                Synchronize;
            finally
                Free;
            end;
        end;
       constructor TForm1.Create(AOwner: TComponent);
        begin
            inherited Create(AOwner);
            ts.ContextClass := TMyContext;
        end;

    As I said in the previous tutorial, this code basically helps to keep the server working flawlessly by synchronizing messages that need to be displayed by components on the server form.

    Next, double click on the connect button and add the following code:

    procedure TForm1.btconnectClick(Sender: TObject);
    begin
    ts.DefaultPort:=strtoint(edport.Text);
    ts.Active:=true;
    memo1.Lines.Add('Server is now connected and ready to accept clients');
    end;

    This code just gets the server  to listen on the said port number as well as display a message.

    More Delphi-Kylix Articles
    More By Jacques Noah


       · 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

    - 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...
    - Using the Client Dataset in File-Based Archi...
    - Demystifying the Client Dataset
    - Working with INI Files in Delphi
    - Creating Data Link (UDL) Files in Delphi
    - Looking at the Details for an Invoicing Appl...
    - Invoicing in Delphi: Show Me the Money
    - Saving Images and Binary Files to a Database...
    - Saving Files to a Database using Delphi: Sav...
    - Creating CF Applications and Integrating a S...
    - Using Try and Finally to Help Prevent Memory...







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway