Delphi-Kylix
  Home arrow Delphi-Kylix arrow Page 3 - Using the Command Handler Method in Delphi
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 
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

Using the Command Handler Method in Delphi
By: Leidago
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 2
    2006-12-18

    Table of Contents:
  • Using the Command Handler Method in Delphi
  • Implementing the Second and Third Commands
  • Setting the Greeting
  • Indy clients
  • Building a More Appealing Client

  • 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


    Using the Command Handler Method in Delphi - Setting the Greeting


    (Page 3 of 5 )

    Now we need to set the greeting text that will be displayed when a client first connects. This is entirely optional; your application will function perfectly fine with or without it.  Click on the idCMDTCPServer1 component and go to its greeting property. Click on the plus sign and go to the "Text" option. Enter "Welcome to my Server" and click OK. Also, add "idcommandhandlers" to the form's uses clause.

    Double click on the form's on create event and add the following code:

    procedure TForm1.FormCreate(Sender: TObject);

    begin

    idcmdtcpserver1.DefaultPort:=6000;

    idcmdtcpserver1.Active:=true;

    end;

    This procedure sets the port at which the server will listen for connections from clients and activates the server. The port number is completely random; you can set any non-known number here. We've covered port numbers in the previous article, so check to see which numbers you should and should not use.

    Compile and run your project. While the application is running, go to your DOS prompt and start telnet by typing "telnet." You should now see the telnet prompt. Type "open localhost 6000".

    I use "Localhost" because I'm running the server application on my local machine. If you are on a network, use your network IP address instead.  I use the 6000 number because that's where we set the server to listen for connections. Press return and you should see something like this:

    I've asked for a quote by typing "Aquote" and pressing the return key. In next screen I ask for today's date and I get:

    Next I close down my connection:

    It is very easy to implement your own protocol with indy servers, once you understand how indy works. CommandHandlers makes this process even easier because of their flexibility and properties, most of which we have not covered here. Hopefully this introduction will inspire you to start experimenting with this technology.

    More Delphi-Kylix Articles
    More By Leidago


       · All comments are welcome, especially from those of you who write client server...
     

    DELPHI-KYLIX ARTICLES

    - 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...
    - Using the Client Dataset in File-Based Archi...
    - Demystifying the Client Dataset
    - Working with INI Files in Delphi






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