UdpSocketIo

Package: inet.applications.udpapp

UdpSocketIo

simple module

C++ definition

Provides UDP socket handling for generic applications.

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
UdpApp compound module

Generates traffic for a UDP application. The traffic source and traffic sink modules can be built from queueing model elements.

Extends

Name Type Description
SimpleModule simple module

Base module for all INET simple modules.

Parameters

Name Type Default value Description
displayStringTextFormat string "rcvd: {numReceived} pks\nsent: {numSent} pks"

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

interfaceTableModule string
localAddress string ""
localPort int -1
destAddress string ""
destPort int
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, ask IP to not fragment the message during routing

dscp int -1

If not -1, set the DSCP (IPv4/IPv6) field 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)

multicastAddresses object []

List of multicast addresses that the application socket joins

receiveBroadcast bool false

If true, make the socket receive broadcast packets

joinLocalMulticastGroups bool false

If true, make the socket receive packets from all multicast groups set on local interfaces

stopOperationExtraTime double -1s

Extra time after lifecycle stop operation finishes

stopOperationTimeout double 2s

Timeout value for lifecycle stop operation

Properties

Name Value Description
class UdpSocketIo
lifecycleSupport
display i=block/socket

Gates

Name Direction Size Description
trafficIn input
trafficOut output
socketIn input
socketOut output

Signals

Name Type Unit Description
packetReceived inet::Packet
packetSent inet::Packet

Statistics

Name Title Source Record Unit Interpolation Mode Description
packetReceived packets received packetReceived count, sum(packetBytes), vector(packetBytes) none
packetSent packets sent packetSent count, sum(packetBytes), vector(packetBytes) none

Source code

//
// Provides UDP socket handling for generic applications.
//
simple UdpSocketIo extends SimpleModule
{
    parameters:
        @class(UdpSocketIo);
        string interfaceTableModule;
        string localAddress = default("");
        int localPort = default(-1);
        string destAddress = default("");
        int destPort;
        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, ask IP to not fragment the message during routing
        int dscp = default(-1); // If not -1, set the DSCP (IPv4/IPv6) field 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)
        object multicastAddresses = default([]); // List of multicast addresses that the application socket joins
        bool receiveBroadcast = default(false); // If true, make the socket receive broadcast packets
        bool joinLocalMulticastGroups = default(false); // If true, make the socket receive packets from all multicast groups set on local interfaces
        double stopOperationExtraTime @unit(s) = default(-1s);    // Extra time after lifecycle stop operation finishes
        double stopOperationTimeout @unit(s) = default(2s);    // Timeout value for lifecycle stop operation
        displayStringTextFormat = default("rcvd: {numReceived} pks\nsent: {numSent} pks");
        @lifecycleSupport();
        @display("i=block/socket");
        @signal[packetSent](type=inet::Packet);
        @signal[packetReceived](type=inet::Packet);
        @statistic[packetSent](title="packets sent"; source=packetSent; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[packetReceived](title="packets received"; source=packetReceived; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
    gates:
        input trafficIn;
        output trafficOut;
        input socketIn;
        output socketOut;
}
File: src/inet/applications/udpapp/UdpSocketIo.ned