TcpSinkApp

Package: inet.applications.tcpapp

compound module TcpSinkApp

Accepts any number of incoming TCP connections, and discards whatever arrives on them. Compatible with both Ipv4 and Ipv6.

Each incoming connection is handled by a separate, dynamically created module, which allows collecting per-connection statistics in a convenient way.

By default, reading from the socket is not rate limited. To allow rate limiting, set autoRead=false, and use the readSize and readDelay parameters to set a rate limit. This will allow TCP flow control to come into effect.

TcpSinkApp

Inheritance diagram

Extends

Name

Type

Description

TcpServerHostApp

simple module

Hosts TCP-based server applications. It dynamically creates and launches a new “thread” object for each incoming connection.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“threads: {numThreads}\nrcvd: {bytesRcvd} bytes”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

localAddress

string

“”

May be left empty (“”)

localPort

int

1000

Port number to listen on

serverThreadModuleType

string

“inet.applications.tcpapp.TcpSinkAppThread”

Module type of “thread” module to launch on incoming connections

stopOperationExtraTime

double

-1s

Extra time after lifecycle stop operation finished

stopOperationTimeout

double

2s

Timeout value for lifecycle stop operation

autoRead

bool

true

Whether to use “autoread” or “explicit-read” mode for TCP connection

readSize

int

-1B

Used only with autoRead==false

readDelay

double

-1s

Used only with autoRead==false; delay for issuing a READ command after previous READ was satisfied; -1 means immediately, 0 means zero delay

Properties

Name

Value

Description

class

TcpSinkApp

display

i=block/sink

lifecycleSupport

Gates

Name

Direction

Size

Description

socketIn

input

socketOut

output

Statistics

Name

Title

Source

Record

Unit

Interpolation Mode

Description

endToEndDelay

end-to-end delay

dataAge(packetReceived)

histogram,weightedHistogram,vector

s

none

packetReceived

packets received

packetReceived

count,”sum(packetBytes)”,”vector(packetBytes)”

none

Source code

//
// Accepts any number of incoming TCP connections, and discards whatever
// arrives on them. Compatible with both ~Ipv4 and ~Ipv6.
//
// Each incoming connection is handled by a separate, dynamically created module,
// which allows collecting per-connection statistics in a convenient way.
//
// By default, reading from the socket is not rate limited. To allow rate
// limiting, set autoRead=false, and use the `readSize` and `readDelay` parameters
// to set a rate limit. This will allow TCP flow control to come into effect.
//
module TcpSinkApp extends TcpServerHostApp
{
    parameters:
        serverThreadModuleType = default("inet.applications.tcpapp.TcpSinkAppThread");
        bool autoRead = default(true); // Whether to use "autoread" or "explicit-read" mode for TCP connection
        volatile int readSize @unit(B) = default(-1B);    // Used only with autoRead==false
        volatile double readDelay @unit(s) = default(-1s);    // Used only with autoRead==false; delay for issuing a READ command after previous READ was satisfied; -1 means immediately, 0 means zero delay
        @class(TcpSinkApp);
        displayStringTextFormat = default("threads: {numThreads}\nrcvd: {bytesRcvd} bytes");
        @display("i=block/sink");
        @statistic[packetReceived](title="packets received"; source=packetReceived; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none; checkSignals=false);
        @statistic[endToEndDelay](title="end-to-end delay"; source="dataAge(packetReceived)"; unit=s; record=histogram,weightedHistogram,vector; interpolationmode=none; checkSignals=false);
}

File: src/inet/applications/tcpapp/TcpSinkApp.ned