Package: inet.applications.udpapp
UdpBasicApp
simple moduleSends UDP packets to the given IP address at the given interval. Compatible with both Ipv4 and Ipv6.
The sending interval can be a constant or a random value (e.g. exponential(1)). If the destAddresses parameter contains more than one address, one of them is randomly chosen for each packet. An address may be given in the dotted decimal notation, or with the module name. (The L3AddressResolver class is used to resolve the address.) To disable the model, set destAddresses to "".
Received packets are discarded.
The peer can be a UdpSink, another UdpBasicApp (it handles received packets like UdpSink), or a UdpEchoApp. When used with UdpEchoApp, the rcvdPkLifetime statistic will contain the round-trip times.
Inheritance diagram
The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
interfaceTableModule | string |
The path to the InterfaceTable module |
|
clockModule | string | "" |
relative path of a module that implements IClock; optional |
localPort | int | -1 |
local port (-1: use ephemeral port) |
destAddresses | string | "" |
list of IP addresses, separated by spaces ("": don't send) |
localAddress | string | "" | |
packetName | string | "UdpBasicAppData" | |
destPort | int | ||
messageLength | int |
length of messages to generate, in bytes |
|
startTime | double | this.sendInterval |
application start time (start of the first packet) |
stopTime | double | -1s |
time of finishing sending, -1s means forever |
sendInterval | double |
should usually be a random value, e.g. exponential(1) |
|
timeToLive | int | -1 |
if not -1, set the TTL (IPv4) or Hop Limit (IPv6) field of sent packets to this value |
dontFragment | bool | false |
if true, asks IP to not fragment the message during routing |
dscp | int | -1 |
if not -1, set the DSCP field (on IPv4/IPv6) of sent packets to this value |
tos | int | -1 |
if not -1, set the Type Of Service (IPv4) / Traffic Class (IPv6) field of sent packets to this value |
multicastInterface | string | "" |
if not empty, set the multicast output interface option on the socket (interface name expected) |
receiveBroadcast | bool | false |
if true, makes the socket receive broadcast packets |
joinLocalMulticastGroups | bool | false |
if true, makes the socket receive packets from all multicast groups set on local interfaces |
stopOperationExtraTime | double | -1s |
extra time after lifecycle stop operation finished |
stopOperationTimeout | double | 2s |
timeout value for lifecycle stop operation |
Properties
Name | Value | Description |
---|---|---|
display | i=block/app | |
lifecycleSupport |
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 | |
rcvdPkLifetime | received packet lifetime | dataAge(packetReceived) | stats, vector | s | none |
throughput | throughput | throughput(packetReceived) | vector | bps | |
rcvdPkSeqNo | received packet sequence number | appPkSeqNo(packetReceived) | vector | none |
Scheduled messages (observed)
msg | kind | ctrl | tags | msgname | context |
---|---|---|---|---|---|
ClockEvent | 1 | sendTimer | |||
ClockEvent | 2 | sendTimer | |||
ClockEvent | 3 | sendTimer |
Direct method calls (observed)
call to | function | info |
---|---|---|
MessageDispatcher | inet::MessageDispatcher::arrived | arrived |
ScenarioManager | inet::ScenarioManager::moduleOperationStageCompleted | moduleOperationStageCompleted |
Called methods (observed)
function | info | call from |
---|---|---|
inet::UdpBasicApp::handleOperationStage | handleOperationStage | ScenarioManager |
Incoming messages (observed)
gate | msg | kind | ctrl | srcModule | tags |
---|---|---|---|---|---|
socketIn | Indication | 1 (UdpStatusInd::UDP_I_ERROR) | UdpErrorIndication | Udp | L3AddressInd, L4PortInd, SocketInd |
socketIn | Indication | 2 (UdpStatusInd::UDP_I_SOCKET_CLOSED) | UdpSocketClosedIndication | Udp | SocketInd |
socketIn | Packet | 0 (UdpStatusInd::UDP_I_DATA) | Udp | DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd, DispatchProtocolInd?, ErrorRateInd?, Ieee802SapInd?, MacAddressInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, Ieee80211ChannelInd?, Ieee80211ModeInd? |
Outgoing messages (observed)
gate | msg | kind | ctrl | destModule | tags |
---|---|---|---|---|---|
socketOut | Packet | 0 (UdpCommandCode::UDP_C_DATA) | Udp | DispatchProtocolReq, L3AddressReq, L4PortReq, SocketReq | |
socketOut | Request | 1 (UdpCommandCode::UDP_C_BIND) | UdpBindCommand | Udp | DispatchProtocolReq, SocketReq |
socketOut | Request | 3 (UdpCommandCode::UDP_C_SETOPTION) | UdpJoinMulticastGroupsCommand | Udp | DispatchProtocolReq, SocketReq |
socketOut | Request | 4 (UdpCommandCode::UDP_C_CLOSE) | UdpCloseCommand | Udp | DispatchProtocolReq, SocketReq |
Packet operations (observed)
chunkType | packetAction |
---|---|
peekData | |
ApplicationPacket | insertAtBack |
Chunk | peekAtFront |
Shared Tagging operations (observed)
tagType | tagAction |
---|---|
DispatchProtocolReq | addTagIfAbsent |
L3AddressReq | addTagIfAbsent |
L4PortReq | addTagIfAbsent |
SocketInd | findTag |
SocketReq | addTagIfAbsent |
Region Tagging operations (observed)
tagType | tagAction |
---|---|
CreationTimeTag | addTag, getAllTags |
Tagging operations (observed)
tagType | tagAction |
---|---|
inet::Ipv4InterfaceData | findTag |
inet::Ipv6InterfaceData | findTag |
inet::NextHopInterfaceData | findTag |
Source code
// // Sends UDP packets to the given IP address at the given interval. // Compatible with both ~Ipv4 and ~Ipv6. // // The sending interval can be a constant or a random value (e.g. exponential(1)). // If the destAddresses parameter contains more than one address, one // of them is randomly chosen for each packet. An address may be given in the // dotted decimal notation, or with the module name. (The L3AddressResolver // class is used to resolve the address.) To disable the model, set // destAddresses to "". // // Received packets are discarded. // // The peer can be a ~UdpSink, another ~UdpBasicApp (it handles received packets // like ~UdpSink), or a ~UdpEchoApp. When used with ~UdpEchoApp, the rcvdPkLifetime // statistic will contain the round-trip times. // simple UdpBasicApp like IApp { parameters: string interfaceTableModule; // The path to the InterfaceTable module string clockModule = default(""); // relative path of a module that implements IClock; optional int localPort = default(-1); // local port (-1: use ephemeral port) string destAddresses = default(""); // list of IP addresses, separated by spaces ("": don't send) string localAddress = default(""); string packetName = default("UdpBasicAppData"); int destPort; volatile int messageLength @unit(B); // length of messages to generate, in bytes double startTime @unit(s) = default(this.sendInterval); // application start time (start of the first packet) double stopTime @unit(s) = default(-1s); // time of finishing sending, -1s means forever volatile double sendInterval @unit(s); // should usually be a random value, e.g. exponential(1) int timeToLive = default(-1); // if not -1, set the TTL (IPv4) or Hop Limit (IPv6) field of sent packets to this value bool dontFragment = default(false); // if true, asks IP to not fragment the message during routing int dscp = default(-1); // if not -1, set the DSCP field (on IPv4/IPv6) of sent packets to this value int tos = default(-1); // if not -1, set the Type Of Service (IPv4) / Traffic Class (IPv6) field of sent packets to this value string multicastInterface = default(""); // if not empty, set the multicast output interface option on the socket (interface name expected) bool receiveBroadcast = default(false); // if true, makes the socket receive broadcast packets bool joinLocalMulticastGroups = default(false); // if true, makes the socket receive packets from all multicast groups set on local interfaces @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); @signal[packetReceived](type=inet::Packet); @statistic[packetReceived](title="packets received"; source=packetReceived; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none); @statistic[throughput](title="throughput"; unit=bps; source="throughput(packetReceived)"; record=vector); @statistic[packetSent](title="packets sent"; source=packetSent; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none); @statistic[rcvdPkLifetime](title="received packet lifetime"; source="dataAge(packetReceived)"; unit=s; record=stats,vector; interpolationmode=none); @statistic[rcvdPkSeqNo](title="received packet sequence number"; source="appPkSeqNo(packetReceived)"; record=vector; interpolationmode=none); gates: input socketIn @labels(UdpControlInfo/up); output socketOut @labels(UdpControlInfo/down); }File: src/inet/applications/udpapp/UdpBasicApp.ned