Package: inet.applications.tcpapp
TcpServerListener
simple moduleOpens a TCP socket to listen on a port, accepts incoming connections, and dynamically creates modules to handle them. The type of modules to be created can be specified in a parameter. The new modules will be appended to the connection[] submodule array of the parent of this module, i.e., they will be siblings of this module.
Accepted TCP connections will inherit the autoRead setting of this module. To allow rate limiting on the connections, set autoRead=false here, and use corresponding parameters of the connection handling module (e.g., readSize and readDelay) to set a rate limit. This will allow TCP flow control to come into effect.
<b>See also:</b> ~TcpServerApp, ~TcpServerConnection
Inheritance diagram
The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.
Used in compound modules
| Name | Type | Description |
|---|---|---|
| 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. |
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 |
| localAddress | string | "" |
May be left empty ("") |
| localPort | int | 1000 |
Port number to listen on |
| serverConnectionModuleType | string | "inet.applications.tcpapp.TcpServerConnection" |
Module type of "connection" module to launch on incoming connections |
| autoRead | bool | true |
Defines the autoRead setting for connection handling modules |
Properties
| Name | Value | Description |
|---|---|---|
| class | TcpServerListener | |
| display | i=block/server |
Gates
| Name | Direction | Size | Description |
|---|---|---|---|
| socketIn | input | ||
| socketOut | output |
Source code
// // Opens a TCP socket to listen on a port, accepts incoming // connections, and dynamically creates modules to handle them. The type of // modules to be created can be specified in a parameter. The new modules // will be appended to the connection[] submodule array of the parent of // this module, i.e., they will be siblings of this module. // // Accepted TCP connections will inherit the `autoRead` setting of this module. To // allow rate limiting on the connections, set autoRead=false here, and use // corresponding parameters of the connection handling module (e.g., `readSize` and // `readDelay`) to set a rate limit. This will allow TCP flow control to come into // effect. // // @see ~TcpServerApp, ~TcpServerConnection // simple TcpServerListener extends SimpleModule { parameters: @class(TcpServerListener); string localAddress = default(""); // May be left empty ("") int localPort = default(1000); // Port number to listen on string serverConnectionModuleType = default("inet.applications.tcpapp.TcpServerConnection"); // Module type of "connection" module to launch on incoming connections bool autoRead = default(true); // Defines the autoRead setting for connection handling modules @display("i=block/server"); gates: input socketIn; output socketOut; }File: src/inet/applications/tcpapp/TcpServerListener.ned