Developing Tcp/Ip-Based Server Applications Using Indy Components

Páginas: 20 (4831 palabras) Publicado: 10 de febrero de 2013
Developing TCP/IP-based Server Applications using Indy Components

Christian Wilkerson


Introduction - What is Indy (A User’s Perspective)

I imagine that everyone interested in the topic of using Indy components to develop servers already knows something about them. But for those that do not, let’s take a brief moment to enlighten you. Indy is short for Internet Direct. Indy is a setof Open Source Delphi Components that allow developers to write network based software. Actually, if you check out the website www.indyproject.org, you will find that the components I am refering to are now called Indy.Sockets. However, if you go way back, you will find that these components got their start long ago as a project called WinShoes. A kind of funny name given that they were awrapper around Microsoft’s Winsock.dll. WinShoes cover Winsock. Get it? The original founder of this project, Chad Z. Hower, aka Kudzu, gets credit for that one.


Our company chose Indy because…

Actually, let me set the record straight. I chose Indy for our company because it was something I had been using for pet projects since it was called WinShoes. I found it to pretty straightforward to use, and loved the fact that it was FREE! As for my company, we are in the security business. Some of our customers you have heard of i.e. the White House, and Homeland Security. We also have others that do not officially exist i.e. Top Secret, Could Tell You but Then I’d Have to Kill You. There are also commercial customers like banks, casinos, and universities. All of thesecustomers require 24/7 reliability. Our company went through a process of having our developers who felt particularly strong towards one set of components or another write demo apps. The demo app utilizing Indy components (written by me) was the quickest and most reliable.


Now that we are all caught up, let’s move on to developing some server applications.



Using TidHTTPServer

Shippingwith Delphi 2005 is Indy.Sockets version 10. It contains 45 different server components allowing you to develop all kinds of different servers for standard protocols. For instance, simply drop a TidHTTPServer component on a form and you are already a long way to developing your own webserver. Does the world really need another web server? If you are talking about writing or re-writing Apache,or IIS, or something along those lines, the answer is probably no. However, think about the possibilities for a moment. How about adding the ability to configure server room software remotely? If you have written an enterprise level system, it could be rather inconvenient to go back to the server room every time you need to adjust the server application. In contrast, it would be veryconvenient to be able to have all of its settings adjustable through a web-browser.
To keep things simple, we will write an application with an embedded webserver that allows for it to be configured remotely. To be more specific we will allow a user to remotely set the color of the main form of our server software with their web-browser.


STEP 1: Create a new VCL Forms Application (Win 32).Save it as HTTPServerExample.
STEP 2: Add Controls - A radio group for color selection, a TidHTTPServer, a TMemo to log activity on the TidHTTPServer, and a checkbox that controls TidHTTPServer’s Active property. Ultimately it should look like Figure 1.


[pic]
Figure 1 - HTTPServerExample's main form




STEP 3: Configure properties and add event code to TidHTTPServer.Note: Here you have a choice to have TidHTTPServer use either fibers or threads for the execution of event code. We will discuss this choice in fuller detail later on in the section dedicated to developing new types of TCP based servers.


TidHTTPServer’s Property Settings:
Set the TidHTTPServer’s Active property equal to True in the Object Inspector....
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Tcp/ip
  • Tcp/Ip
  • TCP IP
  • ¿Que es el tcp/ip?
  • Tcp Ip
  • Tcp Ip
  • Tcp/ip
  • TCP/IP

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS