TcpServerApp¶
Package: inet.applications.tcpapp
compound module TcpServerApp
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 also: TcpClientApp, TcpServerListener, TcpServerConnection
Usage diagram¶
Inheritance diagram¶
Known subclasses¶
Name |
Type |
Description |
|---|---|---|
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 {numProcessedPackets} pk ({processedTotalLength})” |
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++;
}