Operator V1TCPSink

Primitive operator image not displayed. Problem loading file: ../../image/tk$spl/op$spl.compat$V1TCPSink.svg

The V1TCPSink operator writes binary data to a TCP socket that is connected to an InfoSphere Streams Version 1.2 TCP Source operator. It can be configured as a TCP server, which listens for a client connection, or as a TCP client, which initiates a connection to a server. In both modes, it handles a single connection at a time.

The V1TCPSink operator works with both IPv4 and IPv6 addresses. The corresponding Version 1.2 V1TCPSource operator must have a binFormat modifier to send the data in binary format. The V1TCPSink operator is defined in the spl.compat namespace and must be included through a use spl.compat::V1TCPSink; statement.

Exceptions

The V1TCPSink operator throws an exception in the following cases:
  • The host cannot be resolved.

Examples

This example uses the V1TCPSink operator.


composite Main {                                                      
graph                                                                 
    stream<rstring name, int32 age, int32 salary> A = Beacon() {}
    // Send the tuple out to an InfoSphere Streams V1.2 system        
    () as Nil = spl.compat::V1TCPSink(A)                              
    {                                                                 
      param                                                           
         address : "localhost";                                       
         port : 4001u;                                                
         role : client;                                               
         flush : 1u;                                                  
    }                                                                 
}                                                                     

The following example contains the corresponding V1.2 TCP Sink:


Nil := Sink(A) ["ctcp://thishost:4000/", binFormat] {}                 

Summary

Ports
This operator has 1 input port and 0 output ports.
Windowing
This operator does not accept any windowing configurations.
Parameters
This operator supports 7 parameters.

Required: role

Optional: address, flush, port, reconnectionBound, reconnectionPolicy, sendBufferSize

Metrics
This operator reports 1 metric.

Properties

Implementation
C++
Threading
Always - Operator always provides a single threaded execution context.

Input Ports

Ports (0)

The V1TCPSink operator is configurable with a single input port, which ingests tuples to be written over a TCP connection to a V1.x system. The tuple that is accepted by the V1TCPSink operator must contain attributes of supported SPL types only.

Properties

Parameters

This operator supports 7 parameters.

Required: role

Optional: address, flush, port, reconnectionBound, reconnectionPolicy, sendBufferSize

address

Specifies the destination address of the TCP connection in client mode. For more information, see the address parameter in the V1TCPSource operator.

Properties

flush

Specifies the number of tuples after which to flush the output. For more information, see the flush parameter in the spl.adapter::FileSink operator.

Properties

port

Specifies the listening port address in server mode or the destination port address in client mode. For more information, see the port parameter in the V1TCPSource operator.

Properties

reconnectionBound

Specifies the number of successive connections that will be accepted in server mode or attempted in client mode. For more information, see the reconnectionBound parameter in the V1TCPSource operator.

Properties

reconnectionPolicy

In server mode, this parameter specifies whether more connections are allowed when the initial connection terminates. In client mode, this parameter specifies whether more connection attempts are made once the initial connection to the server terminates. For more information, see the reconnectionPolicty parameter in the V1TCPSource operator.

Properties

role

Specifies whether the operator acts as a TCP server or client. For more information, see the role parameter in the V1TCPSource operator.

Properties

sendBufferSize

Specifies the kernel send buffer size for the TCP socket.

Properties

Metrics

nReconnections - Counter

The number of times the TCP connection was re-established.

Libraries

spl-std-tk-lib
Library Name: streams-stdtk-runtime
Include Path: ../../../impl/include