UdpEchoApp.ned
NED File src/inet/applications/udpapp/UdpEchoApp.ned
| Name | Type | Description |
|---|---|---|
| UdpEchoApp | simple module |
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. |
Source code
// // Copyright (C) 2011 OpenSim Ltd. // // SPDX-License-Identifier: LGPL-3.0-or-later // package inet.applications.udpapp; import inet.common.SimpleModule; import inet.applications.contract.IApp; // // 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); }