Internet ToolKit for 4D

 - News !
They use ITK...
To order...
Programmer's Guide
Programmer's FAQ
Upgrade to ITKv2.5
Technical Support
Mailing lists
Year 2000 Info

ITK Programmer's FAQ

You can find the latest version of this document here:


Where do I find ITK examples ?

You can download example databases written with 4D and ITK from our FTP server.


ITK Example database

The first (and oldest) example called "ITK Example" shows a basic HTTP implementation.
It contains some other procedure related to FTP and email.
You can also find other interesting procedures in this example like the WebChecker which acts as a Web client instead of Web server to retrive remote HTML documents to analyse the links and create a final report. The Webchecker is totally "experimental".
Another procedure you should check is the chartmaker or chartdemo which shows how to create dynamic graphics using ITK, 4D and 4D Chart.

This example database is available on ITK's FTP in the standard distributions.


ITK ACME Demo database

The second example database is called "ITK ACME demo".
This demonstration has the following goals:

  • show the same ITK based application running on both MacOS and Windows,
  • show how to search, display and enter new data in a database thru a Web interface (using HTML forms and tables),
  • show how to include pictures stored in the database in dynamically generated HTML answers,
  • show how to handle HTTP "keep-alive" for better performances,
  • show how to handle user authentication using realms.

This example database is available on ITK's FTP.


Juergen's W3 Server 

Juergen von Hirschheydt wrote an optimized HTTP engine. This engine is freely available in the "unsupported" section of ITK's FTP under the name "w3server".

How do I configure TCP/IP for local testing ?

In order to test you 4D/ITK code locally, you need to configure the TCP/IP layers properly. This configuration depends on the kind of operating system and TCP layers installed on your computer and the type of physical network available.

On Macintosh, the MacOS can use MacTCP or OpenTransport.
PCI PowerMacintosh can only use OpenTransport. We recommend to use OpenTransport v1.1 or above.

On Wintel machines, ITK supports Windows 95 and Windows NT. You have to install TCP/IP networking when you install Windows (or install it using the Network control panel).

Some common rules...

  • Each machine must have a unique IP address.
  • IP Addresses are organised in 4 bytes values separated by dots (ie:

MacOS with MacTCP

MacTCP is a control panel. MacTCP comes preinstalled with System 7.5. MacTCP can use either EtherNet, AppleTalk or PPP layers to communicate.

If you want to do local testing, you should select EtherNet or an AppleTalk layer. If you want to communicate with Windows machine on your local EtherNet network, you can only use EtherNet.

Fig. 1

In this first dialog, the "EtherNet" icon is selected meaning that MacTCP will use EtherNet directly.

If the other (left) icon is selected, MacTCP will use AppleTalk to send and receive TCP/IP data.

Set your IP address to an arbitrary valid IP address (like which is a valid C Class IP address). If you are setting several machine on your network, just change the last value in order to have unique IP addresses for each computer (ie:,, etc).

The "More..." button gives access to a second dialog:

Fig. 2

The "Obtain Address" radio buttons allow to select the way the IP address will be obtained. Select "Manually".

You do not need to setup anything more for a minimal configuration.

Click "OK" do save your changes.

Check that the IP Address has not changed in the first dialog and close the dialog. An alert may inform you that you need to restart you Macintosh for the changes to take effect. We recommend to always restart you computer even if you didn't get this alert.

MacOS with OpenTransport

The OpenTransport TCP/IP layers can be configured using the "TCP/IP" control panel.

Here is the minimal configuration that must be set for local testing using an EtherNet local network:

Fig. 3

If you do not have a EtherNet network available you can set OpenTransport TCP/IP to use an AppleTalk compatible network using the following configuration:

Fig. 4

In both cases, if you are setting several machine on your network, just change the last value in order to have unique IP addresses for each computer (ie:,, etc).

How do I include pictures inside dynamicaly generated HTML ?

A common error is to send the picture directly in the HTML data.
When you create an HTML page manually and include a picture, you simply include an "IMG" tag that gives the URL of the picture to be displayed by the browser.

With 4D and ITK it is the same !

You have to put some "IMG" tag in the HTML code you are generating. This tag will force the browser to do another request (or hit) to retrieve the picture and display it.

A good example of picture inclusion can be found in the ITK ACME Demo database.

I'm correctly receiving "GET" HTTP requests but I have problems receiving "POST" requests !

GET and POST HTTP request do not end the same way.

A GET request ends with two consecutive CRLF (which separate the HTTP header and HTTP data which are inexistent in a GET request).

A POST request contains the HTTP header, an empty line (2 consecutive CRLF) and then some HTTP data.

You have to wait for the end of this HTTP data section. With common encoding, this data section end with one CRLF.

In some circumstances, the POST may appear to work correctly mainly because you received both the header and data section at the same time. This is generally the case with fast networks (like local EtherNet networks). Some browsers are also sending the header and data section differently so you may encounter problems with some browsers and everything works fine with others...

All this problems are solved by waiting the end of POSTed data correctly (so waiting for on more CRLF after the 2 consecutive ones).

Where can I get more informations about internet protocols like FTP, email, etc ?

The best place to get information about the Internet is the Internet itself !

Most internet protocols are described in RFCs (Request For Comments). There are more than 2000 RFCs available.

Common RFCs are listed in ITK Programmer's Guide Appendix. All RFCs can be obtained from various locations like the RFC Editor FTP Server.

How can I get technical support for ITK ?

ITK Technical support is handled only using email.

Another source of support is ITK's Mailing list.

How do I handle Base64 encoding/decoding using ITK?

Base64 is supported by ITK version 2.

With ITK v2 you can now use two new commands ITK_Text2B64 and ITK_B642Text.

For ITK version 1 users, Serge Glickman from AGF.SI, published his 4D procedure on the ITK-Mailing-List. You may find a 4D insider library reproducing it on:

How can I recognize ITK license numbers ?

ITKv1 License numbers are starting with 4 letters:

  • ITKD, ITKI, ITKF = ITK Dev License
  • ITKB = ITK Basic License

ITKv2 License numbers are starting with 5 letters:the 4th letter indicate whether it is a "Pro" or "Light" version. The 5th letter indicates whether it is a "Mac" or "Windows" version.

For exemple: ITKPM = ITKv2 Pro Mac

How do I setup OpenTransport 1.3 (and above) multihoming ?

Since version 1.3, OpenTransport support multihoming. The main IP address is defined in the standard TCP/IP control panel, but secondary IP addresses must be defined in a text file called "IP Secondary Addresses" which is located in the Preferences folder.

You'll find a small utility (called OT-Multihoming-Setup) in the "unsupported" section of ITK's FTP that allows you to define these secondary addresses more easily.

Is Internet ToolKit year 2000 compliant ?

Yes, see ITK's Y2K Info page for more details.

ITK_TCPStrmInfo returns negative port numbers !

This is due to the fact that 4D is using SIGNED 16bits integers, and ITK is returning the port number as an Integer. This is more frequent under MacOS 9, but it can also happen on any other OS version (including Windows).

To get the 16bits UNSIGNED equivalent, simply use the following code:

If ($signedPort < 0)
  $unsignedPort := $signedPort+65536
  $unsignedPort := $signedPort
End if