Tivoli Directory Integrator, Version 7.1.1

TCP Connector

The TCP Connector is a transport Connector using TCP sockets for transport. You can use the TCP Connector in Iterator and AddOnly mode only.

Iterator Mode

When in Iterator mode, the TCP Connector waits for incoming TCP calls on a specific port. When a connection is established, the getnext method returns an entry with the following properties:

socket
The TCP socket object (for example, the TCP input and output streams)
in
An instance of a BufferedReader using the socket's input stream
out
An instance of a BufferedWriter using the socket's output stream

The in and out objects can be used to read and write data to or from the TCP connection. For example, you can do the following to implement a simple echo server (put the code in the After GetNext Hook):

var ins = conn.getProperty("in");
var outs = conn.getProperty("out");
var str = ins.readLine();
outs.write("You said==>"+str+"<==");
outs.flush();

Because you are using a BufferedWriter, it is important to call the out.flush() method to make sure data is actually sent out over the connection.

If you specify a Parser, then the BufferedReader is passed to the Parser, which in turn reads and interprets data sent on the stream. The returned entry then includes any attributes assigned by the Parser as well as the properties listed previously (socket, in, and out).

If the TCP Connector is configured in Listen Mode=true then the connection is closed between each call to the getnext method. If Listen Mode=false the connection to the remote host is kept open for as long as the TCP Connector is active (for example, until the AssemblyLine stops).

Note:
The Listen Mode parameter in this connector should not be confused with the behavior of the TCP Server Connector, which is a connector more suited for accepting incoming (multiple concurrent ones, if necessary) TCP requests. The functionality associated with Listen Mode=true is deprecated and will be removed in future versions of the connector, and it will be possible to configure and use the connector for outgoing connections only.

AddOnly Mode

When the TCP Connector works in this mode, the default implementation is to write entries in their string form, which is not useful. Typically, you specify a Parser or use the Override Add hook to preform specific output. In the Override Add hook you access the in or out objects by calling the Connector Interface's getReader() and getWriter() methods, for example:

var in = mytcpconnector.connector.getReader();
var out = mytcpconnector.connector.getWriter();

You can also use the Before Add and After Add hooks to insert headers or footers around the output from your Parser.

Configuration

TCP Host
The remote host to which connections are made (servermode = false).
TCP Port
The TCP port number to connect or listen to (depends on the value of servermode).
Use SSL
If checked, the Connector will deploy the Secure Socket Layer (SSL) on the connection.
Listen Mode
(Deprecated, use TCP Server Connector instead) If true, then Iterating listens for incoming requests. If false, then Iterating connects to a remote server.
Need Client Authentication over SSL
(Deprecated) If checked and if SSL is enabled in Listen Mode (that is, listening for incoming connections), client authentication is necessary.
Connection Backlog
(Deprecated) This represents the maximum queue length for incoming connection indications (a request to connect). If a connection indication arrives when the queue is full, the connection is refused.
Detailed Log
If this parameter is checked, more detailed log messages are generated.

You can select a Parser for this Connector from the Parser pane, where you select a parser by clicking the top-left Select Parser button.

See also

File Connector,
Direct TCP /URL scripting,
TCP Server Connector
URL Connector.
[ Top of Page | Previous Page | Next Page | Contents | Terms of use | Feedback ]
(C) Copyright IBM Corporation, 2003, 2012. All Rights Reserved.
IBM Tivoli Directory Integrator 7.1.1