Setting the Server Information

Note: We do not need to do this for the JavaScript PopChart Embedder. For now you can skip this section. However, you will need to complete this step for other versions of the PopChart Embedder.

An important step in embedding a PopChart image is to tell the PopChart Embedder the location of PopChart Server. With the JavaScript embedder, you have already done this when you imported the PopChart Embedder library (you had to tell the web page where to find PopChart Server in order to import the PopChart Embedder library).

With other versions of the PopChart Embedder, however, you need to set two PopChart Embedder attributes, externalServerAddress and internalCommPortAddress. To make sure you are aware of these attributes, we introduce them now. However, you will not actually use them until Chapter 5.

External Server Address

The externalServerAddress attribute tells PopChart Embedder what address web clients will use to access PopChart Server. Web clients will always access PopChart Server on the server port, which by default is 2001. So, for example, if PopChart Server is running on port 2001, and web servers access it via address http://pcserver.mycompany.com, you would need to include the following line of code:

myPopChart.externalServerAddress = "http://pcserver.mycompany.com:2001";

Note: If you are using the a redirector, your external server address will be the address of the redirector. You should not include a port number when you use the redirector. For more information, refer to "Using HTTP Redirection".

Internal Comm Port Address

The internalCommPortAddress attribute tells PopChart Embedder what address PopChart Embedder should use to access PopChart Server. PopChart Embedder will always access PopChart Server on the comm port, which by default is 2002.

The actual address of the PopChart Server is often the same as the address that you specified as the external server address. If this is the case, then the following line of code would accompany the line of code we used to set the external server address:

myPopChart.internalCommPortAddress = "http://pcserver.mycompany.com:2002";

However, it is not always the case that the web clients and the PopChart Embedder talk to PopChart Server at the same address. Behind a firewall, or if you are using a redirector (see Chapter 12) or clustering (see Chapter 13), PopChart Embedder may communicate with PopChart Server at a different address. This address will depend greatly upon how your PopChart Server is set up.