TCP

Description

TCP client/server communication functions. There are functions to run and manage local TCP servers and also for remote TCP client connections.

Categories

NameDescription
AdvancedAdvanced TCP client/server communication functions that allow direct access to the underlying Java infrastructure.

Functions

NameSignature and Synopsis
connectToRemoteServervoid connectToRemoteServer(String sessionNickName, String host, int port)
Connects to a remote TCP server running on the given host name and port. This remote session will be registered under the nick name provided.
createLocalServervoid createLocalServer(String serverNickName, String host, int port)
Starts a local TCP server using the host name and port provided. The server will be registered under the given nick name.
disconnectFromRemoteServervoid disconnectFromRemoteServer(String sessionNickName)
Disconnects the remote session that was created previously using connectToRemoteServer(sessionNickName, host, port).
disconnectLocalSessionvoid disconnectLocalSession(String sessionNickName)
Disconnects the session that was connected to the local server.
endReadvoid endRead(String sessionNickName)
Stops reading and signals the end of this read session.
endWritevoid endWrite(String sessionNickName)
Flushes the writes and signals the end of this write session.
readIntoPayloadEvent readIntoPayload(String sessionNickName, int maxNumBytesToRead, String uriOfResponseEvent)
Attempts to read the maximum number of bytes specified into the payload of a new event whose URI is provided.
readIntoPayloadFullyEvent readIntoPayloadFully(String sessionNickName, String uriOfResponseEvent)
Attempts to read all the bytes from the stream into the payload of a new event whose URI is provided. If the stream is not going to fit into memory or is going to be very large, avoid using this method.
registerSessionListenervoid registerSessionListener(String serverNickName, String uriOfRuleFunction)
This must be performed before calling startLocalServer(serverNickName).
startLocalServervoid startLocalServer(String serverNickName)
Starts the local server that was registered previously using createLocalServer(serverNickName, host, port).
stopLocalServervoid stopLocalServer(String serverNickName)
Stops the local server that was registered under the given nick name.
writevoid write(String sessionNickName, Event eventWithPayload)
Writes the payload of the event provided to the TCP session. '$1$10' at the end of the payload string can be written to mark the EOF (Useful for Flash).