TcpMap — specify which ports should Interchange server running in Inet mode listen on
The TcpMap
directive defines a list of host addresses and ports that
the Interchange server should listen on (when running in Inet mode using
tlink
link program, of course).
In the past, Interchange had its own built-in Web server which also allowed for binding of specific catalogs to specific ports. Since this built-in server is long gone now, its behavior was replaced by a combination of aliases on the real Web server and Interchange catalog definitions. See the section called “EXAMPLES” for clarification.
By default, Interchange listens on all IP addresses, on port 7786
.
The port number comes from the ASCII values of letters M
and
V
, which stood for "MiniVend
"
(see Interchange
About and History page for more background information).
host_and_port_specification
defines hostnames and
ports to bind to. Self-explanatory examples include 7786
,
*:7786
, 127.0.0.1:7786
or
myhost.mydomain.local:7786
.
catalog_specification
is the name of the catalog to
offer on selected hostname and port. Since there is no more built-in
Web server in Interchange, the only sensible definition is "-
".
Example: Defining TcpMap
The following makes Interchange listen on three ports.
TcpMap 7786 - 7787 - 7788 -
Example: Mass-defining TcpMap
To define a large number of ports, the "here document" capability of Interchange configuration engine can be used:
TcpMap <<EOD *:7786 - 127.0.0.1:7787 - myhost.mydomain.local:7788 - *:7789 - EOD
Example: Offering specific catalogs on specific ports
Even though the internal Web server in Interchange is gone,
tlink
(Inet link program) still relies only on
the SCRIPT_PATH
environment variable to determine which
catalog was requested. This means that the
functional equivalent of catalogs bound to ports can still be achieved (without
TcpMap
),
by the use of Web server location aliases and Interchange script path aliases.
Actually, you'd probably want to do this just to reduce the length of
HTML links.
Here's an example of needed Apache Web server configuration:
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ ScriptAlias /CATALOG_NAME /usr/lib/cgi-bin/ic/CATALOG_NAME <Directory "/usr/lib/cgi-bin"> AllowOverride None Options ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory>
And here's the appropriate catalog definition in interchange.cfg
:
Catalog CATALOG_NAME /PATH/TO/CATALOG/CATALOG_NAME /cgi-bin/ic/CATALOG_NAME /CATALOG_NAME
Interchange 5.9.0:
Source: lib/Vend/Config.pm
Line 3188 (context shows lines 3188-3205)
sub parse_hash { my($item,$settings) = @_; if (! $settings) { return $HashDefaultBlank{$item} ? '' : {}; } my $c; if(defined $C) { $c = $C->{$item} || {}; } else { no strict 'refs'; $c = ${"Global::$item"} || {}; } return hash_string($settings,$c); }