UdpEchoApp¶
Package: inet.applications.udpapp
simple module UdpEchoApp
Listens on a UDP port and sends back each received packet to its sender. Note: when used together with UdpBasicApp, UdpBasicApp’s “received packet lifetime” statistic will record round-trip times.
Inheritance diagram¶
Extends¶
Name |
Type |
Description |
|---|---|---|
simple module |
Base module for all INET simple modules. |
Parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
displayStringTextFormat |
string |
“echoed: {numEchoed} pks” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
interfaceTableModule |
string |
The path to the InterfaceTable module |
|
localPort |
int |
Local port to listen on |
|
stopOperationExtraTime |
double |
-1s |
Extra time after lifecycle stop operation finished |
stopOperationTimeout |
double |
2s |
Timeout value for lifecycle stop operation |
Properties¶
Name |
Value |
Description |
|---|---|---|
class |
UdpEchoApp |
|
display |
i=block/app |
|
lifecycleSupport |
Gates¶
Name |
Direction |
Size |
Description |
|---|---|---|---|
socketIn |
input |
||
socketOut |
output |
Signals¶
Name |
Type |
Unit |
Description |
|---|---|---|---|
packetSent |
Statistics¶
Name |
Title |
Source |
Record |
Unit |
Interpolation Mode |
Description |
|---|---|---|---|---|---|---|
echoedPk |
packets echoed |
packetSent |
count,”sum(packetBytes)”,”vector(packetBytes)” |
none |
Source code¶
//
// Listens on a UDP port and sends back each received packet to its sender.
// Note: when used together with ~UdpBasicApp, ~UdpBasicApp's "received packet
// lifetime" statistic will record round-trip times.
//
simple UdpEchoApp extends SimpleModule like IApp
{
parameters:
@class(UdpEchoApp);
string interfaceTableModule; // The path to the InterfaceTable module
int localPort; // Local port to listen on
displayStringTextFormat = default("echoed: {numEchoed} pks");
@display("i=block/app");
@lifecycleSupport;
double stopOperationExtraTime @unit(s) = default(-1s); // Extra time after lifecycle stop operation finished
double stopOperationTimeout @unit(s) = default(2s); // Timeout value for lifecycle stop operation
@signal[packetSent](type=inet::Packet);
@statistic[echoedPk](title="packets echoed"; source=packetSent; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
gates:
input socketIn @labels(UdpCommand/up);
output socketOut @labels(UdpCommand/down);
}