User Guide

Table Of Contents
Using the example event gateways and gateway applications 1041
The SocketGateway.java file defines two classes: SocketGateway, the event gateway, and
SocketHelper, a GatewayHelper class. The Source file is located in the gateway\src\examples\
socket directory.
SocketGateway Listens on a TCP/IP port. This event gateway is multithreaded and can
handle multiple clients simultaneously. It can send outgoing messages to existing clients, but
cannot establish a link itself.
By default, the SocketGateway class listens on port 4445, but you can specify the port number in
a configuration file. The file should contain a single line in the following format:
port=portNumber
SocketHelper
A GatewayHelper class with the following methods:
getSocketIDs() returns an array containing the socket IDs of all Java sockets that are open.
The event gateway opens a socket for each remote client.
killSocket(String socketid) Removes the specified socket. Returns a Boolean success
indicator.
DirectoryWatcherGateway
The DirectoryWatcherGateway event gateway sends events to the listener CFC when a file is
created, deleted, or modified in a directory. The watcher runs in a thread that sleeps for an
interval specified in the configuration file, and when the interval has passed, checks for changes
since the last time it was awake. If it finds added, deleted, or changed files, it sends a message to a
listener CFC. You can configure separate CFCs for add, delete, and change events, or use a single
CFC for all events. The source for this event gateway is located in the gateway/src/examples/
watcher directory.
Note: The ColdFusion MX Administrator uses DirectoryWatcher as the gateway type name for the
DirectoryWatcherGateway class.
Configuration file
This event gateway requires a configuration file, consisting of lines in the following format:
directory=C:/temp
Note: If you use backward slash characters (\) as directory separators in Windows the file paths, you
must escape them by using double slashes, as in C:\\temp. You can use forward slashes (/) as the
directory separator on all operating systems, including Windows.
The configuration file can have comment lines, preceded by a number sign (#). If you omit a
property or comment it out, ColdFusion uses the default value. If you specify a property with no
value, ColdFusion sets an empty property. The configuration file can define the following values:
Property Req/Opt Description
directory Required Path to the directory to watch.
recurse Optional Whether to check subdirectories. The default value is
No.