Package: inet.applications.tcpapp
TcpEchoApp
simple moduleAccepts any number of incoming TCP connections, and sends back the messages that arrive on them, The lengths of the messages are multiplied by echoFactor before sending them back (echoFactor=1 will result in sending back the same message unmodified.) The reply can also be delayed by a constant time (echoDelay parameter).
Compatible with both Ipv4 and Ipv6.
Inheritance diagram
The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.
Extends
Name | Type | Description |
---|---|---|
TcpServerHostApp | simple module |
This 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 |
---|---|---|---|
localAddress | string | "" |
may be left empty ("") |
localPort | int | 1000 |
port number to listen on |
serverThreadModuleType | string | "inet.applications.tcpapp.TcpEchoAppThread" |
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 |
echoFactor | double | 1 | |
echoDelay | double | 0s |
Properties
Name | Value | Description |
---|---|---|
display | i=block/app | |
lifecycleSupport | ||
class | TcpEchoApp |
Gates
Name | Direction | Size | Description |
---|---|---|---|
socketIn | input | ||
socketOut | output |
Signals
Name | Type | Unit |
---|---|---|
packetReceived | inet::Packet | |
packetSent | inet::Packet |
Statistics
Name | Title | Source | Record | Unit | Interpolation Mode |
---|---|---|---|---|---|
packetReceived | packets received | packetReceived | count, sum(packetBytes), vector(packetBytes) | none | |
packetSent | packets sent | packetSent | count, sum(packetBytes), vector(packetBytes) | none | |
endToEndDelay | end-to-end delay | dataAge(packetReceived) | histogram, weightedHistogram, vector | s | none |
Direct method calls (observed)
call to | function | info |
---|---|---|
MessageDispatcher | inet::MessageDispatcher::arrived | arrived |
Incoming messages (observed)
gate | msg | kind | ctrl | srcModule | tags |
---|---|---|---|---|---|
socketIn | Indication | 3 (TcpStatusInd::TCP_I_AVAILABLE) | TcpAvailableInfo | Tcp | SocketInd |
socketIn | Indication | 3 (TcpStatusInd::TCP_I_AVAILABLE) | TcpAvailableInfo | TcpLwip | SocketInd, TransportProtocolInd |
socketIn | Indication | 4 (TcpStatusInd::TCP_I_ESTABLISHED) | TcpConnectInfo | Tcp | SocketInd |
socketIn | Indication | 4 (TcpStatusInd::TCP_I_ESTABLISHED) | TcpConnectInfo | TcpLwip | SocketInd, TransportProtocolInd |
socketIn | Indication | 5 (TcpStatusInd::TCP_I_PEER_CLOSED) | TcpCommand | Tcp | SocketInd |
socketIn | Indication | 5 (TcpStatusInd::TCP_I_PEER_CLOSED) | TcpCommand | TcpLwip | SocketInd, TransportProtocolInd |
socketIn | Indication | 6 (TcpStatusInd::TCP_I_CLOSED) | TcpCommand | Tcp | SocketInd |
socketIn | Packet | 1 (TcpStatusInd::TCP_I_DATA) | Tcp | SocketInd | |
socketIn | Packet | 1 (TcpStatusInd::TCP_I_DATA) | TcpLwip | SocketInd, TransportProtocolInd |
Outgoing messages (observed)
gate | msg | kind | ctrl | destModule | tags |
---|---|---|---|---|---|
socketOut | Packet | 4 (TcpCommandCode::TCP_C_SEND) | Tcp | DispatchProtocolReq, SocketReq | |
socketOut | Packet | 4 (TcpCommandCode::TCP_C_SEND) | TcpLwip | DispatchProtocolReq, SocketReq | |
socketOut | Request | 2 (TcpCommandCode::TCP_C_OPEN_PASSIVE) | TcpOpenCommand | Tcp | DispatchProtocolReq, SocketReq |
socketOut | Request | 2 (TcpCommandCode::TCP_C_OPEN_PASSIVE) | TcpOpenCommand | TcpLwip | DispatchProtocolReq, SocketReq |
socketOut | Request | 3 (TcpCommandCode::TCP_C_ACCEPT) | TcpAcceptCommand | Tcp | DispatchProtocolReq, SocketReq |
socketOut | Request | 3 (TcpCommandCode::TCP_C_ACCEPT) | TcpAcceptCommand | TcpLwip | DispatchProtocolReq, SocketReq |
socketOut | Request | 5 (TcpCommandCode::TCP_C_CLOSE) | TcpCommand | Tcp | DispatchProtocolReq, SocketReq |
socketOut | Request | 5 (TcpCommandCode::TCP_C_CLOSE) | TcpCommand | TcpLwip | DispatchProtocolReq, SocketReq |
Packet operations (observed)
chunkType | packetAction |
---|---|
peekData, peekDataAt | |
ByteCountChunk | insertAtBack |
BytesChunk | insertAtBack |
SliceChunk | insertAtBack |
Shared Tagging operations (observed)
tagType | tagAction |
---|---|
DispatchProtocolReq | addTagIfAbsent |
SocketInd | findTag, getTag |
SocketReq | addTag, addTagIfAbsent, getTag |
Region Tagging operations (observed)
tagType | tagAction |
---|---|
CreationTimeTag | getAllTags |
Source code
// // Accepts any number of incoming TCP connections, and sends back the // messages that arrive on them, The lengths of the messages are // multiplied by echoFactor before sending them back (echoFactor=1 will // result in sending back the same message unmodified.) The reply can also be // delayed by a constant time (echoDelay parameter). // // Compatible with both ~Ipv4 and ~Ipv6. // simple TcpEchoApp extends TcpServerHostApp { parameters: @class(TcpEchoApp); double echoFactor = default(1); double echoDelay @unit(s) = default(0s); serverThreadModuleType = default("inet.applications.tcpapp.TcpEchoAppThread"); // module type of "thread" module to launch on incoming connections @signal[packetSent](type=inet::Packet); @signal[packetReceived](type=inet::Packet); @statistic[packetReceived](title="packets received"; source=packetReceived; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none); @statistic[packetSent](title="packets sent"; source=packetSent; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none); @statistic[endToEndDelay](title="end-to-end delay"; source="dataAge(packetReceived)"; unit=s; record=histogram,weightedHistogram,vector; interpolationmode=none); }File: src/inet/applications/tcpapp/TcpEchoApp.ned