HOME - - - - - Delphi Tutorials TOC - - - - - - - - - - - - Other material for programmers
    Delicious Bookmark this on Delicious   Recommend to StumbleUpon

Delphi: Using TCP/IP to access HTML, over LAN or WAN. Using HTTP.

To the internet, and beyond!

This has good information, and a search button at the bottom of the page

Please don't dismiss it because it isn't full of graphics, scripts, cookies, etc!

More information about the source and format of these pages is available.


I am fairly comfortable creating applications in Delphi. I can put up a static page on the web.

I have little experience of the "innards" of TCP/IP and HTTP... but with a little help, I've made a small application which can fetch the HTML inside a webpage from across the internet, and look at it. It's a start! (I make no attempt to convert the HTML into the display that a browser presents.)(You really don't need the details of what my application does, but if you want them, they are at my FarWatchWatcher page. It is a module in a system- FarWatch- to monitor premises remotely.)

I spoke of "a little help". Actually, it was a great deal of help. I started with a demo application which fetches the contents of a web page and puts it in a memo. I have very little knowledge of the details of that... thank heavens. A freeware suite of tools for Delphi (or C++) did all of the "heavy lifting" for me. More on that in a moment. "All" I did was the programming concerned with looking at what was in the memo after it had been fetched. The demo I built my application on included the capability of using DNS.... in other words, I could ask for the contents of, say, http://bbc.co.uk, and the looking up of the IP address was taken care of for me behind the scenes. (It also works if I put in an IP address... be the server "out on the web", or local, e.g. at 192.168.0.150, say.)


So far so good? I hope so. Onward....

From here, we will....


The freeware: Francois Piette's Internet Components Suite: Overbyte ICS

I'm not... in general... a fan of third party components for Delphi. I'm probably a fool for eschewing them, but I am a sane fool who's mental equilibrium hasn't been taxed by some of the extra "issues" which can arise.

However, for every rule, there are exceptions. I am very happy to install the (free!) "Internet Component Suite" into my Delphi, for the many extra opportunities it creates for me.

It has been around for a long time. It has a thriving forum where serious people discuss technical things intelligently. I've never had my Delphi installation misbehave as a result of the presence of the ICS.

Go to the OverByte site, and use the menu at the left to drill down into the ICS material. Enjoy! (You don't, by the way, need to install a subversion client to download and use the ICS. But DO read the "install" notes in the textfile in the zip.)

In November 2010 I installed the ICS from scratch in an XP machine and used it with Delphi 7, the "Personal" edition. Note: Some editions of later versions of Delphi do not allow you to install third party components. The people owning the rights to Delphi in 2010 have not, for at least several years, seemed very interested in the amateur or hobbyist. Pity.

I have done a separate page with details of how I installed the Piette ICS on my Windows XP system, November, 2010.

I hope I've already convinced you to try the ICS? If so, you can go to the "How I installed" page from the link above, or skip down to the "Blocking..." or "Adapting..." topics below. If you're still wondering if you need ICS, the rest of this section is here to help with that.

The following is adapted from text on the site ICS comes from.... Begin Quote from OverByte.de....

The Internet Component Suite  is composed of various Internet
components and applications. It is distributed as freeware with
full source code  for all Delphi and C++Builder versions.

The sample applications exist in two forms: Object Pascal (for
Delphi) and C++ (for C++Builder). The components are written in
Object Pascal native VCL which can be compiled by Delphi as well
as C++Builder.

....End Quote from OverByte.de

=========================

The following is adapted from material at another supporter's site, http://www.mestdagh.biz/ics/help/. .... Begin Quote from mestdagh.biz....

At the heart of ICS are TWSocket and TWSocketServer components.
They encapsulates the winsock API, offering support for TCP,
UDP, and ICMP protocol.

Included in the suite is a series of higher level components,
encapsulating various common Internet protocols, such as POP3,
SMTP, FTP, HTTP, SOCKS and others. All of these components
either use TWSocket or are derived from it.

Some of the components have a synchronous version (like
TSyncPop3Cli), while others have synchronous methods added.
However, the use of either of these is deprecated. It is
strongly encouraged to use the asynchronous version (like
TPop3Cli) or the asynchronous methods instead (see individual
help.)

Asynchronous means that a component is non-blocking; a method
call will return immediately while the component will do the
request in the background. When the request is done, an event
will fire indicating it.

Using synchronous approaches can lead to blocking.

End Quote from mestdagh.biz

The issues of synchronous/ blocking approaches are explored more fully elsewhere.


Non-Blocking programs / Asynchronous interaction with remote sites

To every simple question there is a simple answer... and it is wrong.

When you "talk" across the internet, you encounter delays. Within a Windows or other modern computer, it is a problem if a program "hangs up" in a loop, waiting for the end of a delay.

There are answers to the dilemma... answers you will have to master if you are to make much progress with TCP/IP programming. I have produced a separate page trying to help you understand the need for non-blocking programming.


Adapting the demo named "OverByteHttpTst"

If you are new to TCP/IP programming, you will, I hope, be amazed by what you can learn in my tutorial which ostensibly makes "just a little" modification of the OverByte demo "OverByteICSHttpTst". I certainly learnt a lot while writing it!


            powered by FreeFind
  Site search Web search
Site Map    What's New    Search This search merely looks for the words you enter. It won't answer "Where can I download InpOut32?"

Click here if you're feeling kind! (Promotes my site via "Top100Borland")


If you visit 1&1's site from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service. They offer things for the beginner and the corporation.www.1and1.com icon

Ad from page's editor: Yes.. I do enjoy compiling these things for you. I hope they are helpful. However... this doesn't pay my bills!!! Sheepdog Software (tm) is supposed to help do that, so if you found this stuff useful, (and you run a Windows or MS-DOS PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

Link to Tutorials main page
How to email or write this page's editor, Tom Boyd


Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org


If this page causes a script to run, why? Because of things like Google panels, and the code for the search button. Why do I mention scripts? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....