Delphi-Kylix
  Home arrow Delphi-Kylix arrow Sever Side Chat Application with Borland D...
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  
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

Sever Side Chat Application with Borland Delphi/Indy
By: Jacques Noah
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 12
    2005-12-26

    Table of Contents:
  • Sever Side Chat Application with Borland Delphi/Indy
  • The Code
  • Receiving messages: listnames, all, takeshot, name, file
  • Handling Commands: Listnames, all, takeshot
  • Handling commands: name, file

  • 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


    Sever Side Chat Application with Borland Delphi/Indy


    (Page 1 of 5 )

    This article will get you started on building a chat application based on the client/server model. It will be able to handle all of the basics found in chat applications like Microsoft Messenger and others.
    A downloadable zip of the COMPLETE source code for the application is available here.

    Introduction

    Most chat applications are based on a client/server model, i.e. the client logs on to a server, gets a list of other clients who are logged on and sends messages to them. When you decide to join a chat, the software program that you use connects to a server somewhere and allows you to ‘talk’ to other people who are connected to that server. 

    Our chat application is also going to be based on client/server model.  What we are going to do in this tutorial is look at how the server enables clients to communicate. We are also going to look at how the server sends files to other clients, take screenshots and sends these back to your computer.  We will set up our own little communication protocol.

    Requirements for the Server Application:

    • We want the server to be able to keep a record of every client on the chat.
    • We want it to be able to send files and take screenshots of connected clients.
    • We want it to send text to everybody or a single person (private chat), with the possibility of doing a three way chat.
    What you need

    You need to have Indy 9 or 10 installed. If you have Delphi 6 or above, then you can skip this section; otherwise go to www.indyproject.org and download the version appropriate to your Delphi version. I am using Delphi 7 and Indy 10.0.52. There are proper guides available on the indy site, on how to install Indy on your computer.

    Let's get started!

    Fire up Delphi and create a new application. Go to the indy server tab, select and add the idtcpserver (make sure that it is the idtcpserver and NOT the idsimpletcpserver or anything else), then go to the object inspector and change its name to ts. Now, the application itself will not be seen by the clients (people who log on to the server), so it is up to you as to how you want to decorate it.

    The determining factor here is whether your server is going to have a fixed port number, in which case you can just hard code it into the server. Otherwise you will need to follow my design, which will be flexible in terms of port number assignment. To make the server flexible, add a tedit component and a label (available on the Standard Tab). Give the tedit the name edpor, and name the label Set Port Numbe. Also, add a tmemo. We will use this to display who logged on/off. I will explain below why we need a port number.

    Port Number

    The port number is used by the server application to listen for clients who want to join or log on to the chat. There are over 650000 port numbers available, but I would recommend you use any number from 4000 as some port numbers are reserved for other services such as SMTP on port 25, POP3 on port 110, HTTP on 80, and so on; be careful when choosing a port number for your server. Go to: http://www.i386.info/ports.htm  for a list of known ports and further information.

    My server app, so far:

    More Delphi-Kylix Articles
    More By Jacques Noah


       · We hope you found this article enjoyable and educational. Please feel free to...
       · This has been really informative, and helped me redesign a freeware game servrer I...
       · For all those who sent me emails requesting to download the chat application. I've...
       · I downloaded the file and ran it under D7 and using Indy10.1.5[Error]...
     

    DELPHI-KYLIX ARTICLES

    - 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...
    - 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






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