TcpServerApp

Package: inet.applications.tcpapp

TcpServerApp

compound module

A generic, modular TCP server application. It is composed of a listener module that listens on a port to accept TCP connections, and for each incoming TCP connection it dynamically creates a new module in the connection[] submodule vector to handle the connection.

<b>See also:</b> ~TcpClientApp, ~TcpServerListener, ~TcpServerConnection

listener : TcpServerListener

Opens a TCP socket to listen on a port, accepts incoming connections, and dynamically creates...

Source:
listener: TcpServerListener {
    parameters:
        @display("p=100,100");
} connection[0] : like IApp

IApp: Generic application interface.

Source:
connection[0]: <default(listener.serverConnectionModuleType)> like IApp {
    parameters:
        @display("p=200,100,row,50");
} ta : MessageDispatcher

Facilitates the interconnection of applications, protocols, and network interfaces, dispatching...

Source:
ta: MessageDispatcher {
    parameters:
        @display("p=100,200");
}

Usage diagram

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram.

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Known subclasses

Name Type Description
TelnetServerApp compound module

This server application accepts and creates telnet server connections.

Parameters

Name Type Default value Description
interfaceTableModule string

Relative module path of the interface table

Properties

Name Value Description
display i=block/app

Gates

Name Direction Size Description
socketIn input
socketOut output

Unassigned submodule parameters

Name Type Default value Description
listener.displayStringTextFormat string ""

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

listener.localAddress string ""

May be left empty ("")

listener.localPort int 1000

Port number to listen on

listener.serverConnectionModuleType string "inet.applications.tcpapp.TcpServerConnection"

Module type of "connection" module to launch on incoming connections

listener.autoRead bool true

Defines the autoRead setting for connection handling modules

ta.displayStringTextFormat string "processed %p pk (%l)"

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

ta.interfaceTableModule string

Module path to the ~InterfaceTable module

ta.forwardServiceRegistration bool true
ta.forwardProtocolRegistration bool true
ta.interfaceMapping object {}

Maps network interface names to connected submodule names (e.g. {"eth0": "bridging"}), overrides automatically learned dispatching; * overrides all learned network interfaces, ? overrides default

ta.serviceMapping object {}

Maps protocols to connected submodule names (e.g. {"ethernetmac": "bridging"}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default

ta.protocolMapping object {}

Maps protocols to connected submodule names (e.g. {"ipv4": "bridging"}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default

Source code

//
// A generic, modular TCP server application. It is composed of a
// listener module that listens on a port to accept TCP connections, and for each
// incoming TCP connection it dynamically creates a new module in the connection[]
// submodule vector to handle the connection.
//
// @see ~TcpClientApp, ~TcpServerListener, ~TcpServerConnection
//
module TcpServerApp like IApp
{
    parameters:
        string interfaceTableModule; // Relative module path of the interface table
        *.interfaceTableModule = default(this.interfaceTableModule);
        @display("i=block/app");
    gates:
        input socketIn;
        output socketOut;
    submodules:
        listener: TcpServerListener {
            parameters:
                @display("p=100,100");
        }
        connection[0]: <default(listener.serverConnectionModuleType)> like IApp {
            parameters:
                @display("p=200,100,row,50");
        }
        ta: MessageDispatcher {
            parameters:
                @display("p=100,200");
        }
    connections:
        ta.out++ --> listener.socketIn;
        listener.socketOut --> ta.in++;
        ta.out++ --> { @display("m=s"); } --> socketOut;
        socketIn --> { @display("m=s"); } --> ta.in++;
}
File: src/inet/applications/tcpapp/TcpServerApp.ned