TcpServerSocketIo

Package: inet.applications.tcpapp

simple module TcpServerSocketIo

Manages an established TCP connection. It handles data transmission to and from a module connected via the trafficIn and trafficOut gates. When data is received on the trafficIn gate, it is forwarded on the TCP connection via the socketOut gate, and vice versa. This module simplifies the task of data exchange over an established TCP connection.

Note that reading from the socket is only rate limited if the connection was originally created with the autoRead=false setting. Then, you can use the readSize and readDelay parameters to set a rate limit. This will allow TCP flow control to come into effect.

See also: TcpServerConnection, TcpServerListener, TcpClientSocketIo

inet.applications.tcpapp.TcpServerSocketIoTcpServerSocketIosimple

Usage diagram

Inheritance diagram

Used in compound modules

Name

Type

Description

TcpServerConnection

compound module

This is a pre-assembled module type to be used in TcpServerApp. One instance of this module type is launched by TcpServerListener for each incoming connection. It is composed of a traffic source, a traffic sink, a socket I/O and other modules, and most of the module types are parametric. The traffic source and traffic sink modules can be built from queueing model elements.

TelnetServerConnection

compound module

Contains a configurable pre-composed telnet traffic source and traffic sink as part of a telnet server application.

Extends

Name

Type

Description

SimpleModule

simple module

Base module for all INET simple modules.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“”

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

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

TcpServerSocketIo

display

i=block/socket

Gates

Name

Direction

Size

Description

trafficIn

input

trafficOut

output

socketIn

input

socketOut

output

Source code

//
// Manages an established TCP connection. It handles data transmission to and
// from a module connected via the `trafficIn` and `trafficOut` gates. When data is
// received on the `trafficIn` gate, it is forwarded on the TCP connection via the
// `socketOut` gate, and vice versa. This module simplifies the task of data
// exchange over an established TCP connection.
//
// Note that reading from the socket is only rate limited if the connection was
// originally created with the autoRead=false setting. Then, you can use the
// `readSize` and `readDelay` parameters to set a rate limit. This will allow TCP
// flow control to come into effect.
//
// @see ~TcpServerConnection, ~TcpServerListener, ~TcpClientSocketIo
//
simple TcpServerSocketIo extends SimpleModule
{
    parameters:
        @class(TcpServerSocketIo);
        @display("i=block/socket");
        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
    gates:
        input trafficIn;
        output trafficOut;
        input socketIn;
        output socketOut;
}

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