Creating Chat Application with Borland Delphi/Indy: The Client
In this third article in a series on building a chat application, you will learn how to build the user interface, how to create code to deal with messages sent from the server, how to send a request to the server, and more.
Creating Chat Application with Borland Delphi/Indy: The Client (Page 1 of 5 )
A downloadable zip of the COMPLETE source code for the application is available here.
In this part we are going to build the Client side of the chat server application. This is the visual representation of the entire application. This is the part the user will use to interact with the server, as well as with other people on the chat. The diagram below shows how this works:
Creating the client is very simple, because all the hard work is done by the server. All that the client application really does is send a series of commands (remember our custom communication protocol?); the server executes the commands. The first part of the client application deals with receiving messages from the server. The second part deals with sending requests to the server.
Requirements for the Client Application:
We want to be able to get a record of every client on the chat.
We want 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 and 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.