Error with thruputMeter and inet 2.4.0 (cannot cast)

199 views
Skip to first unread message

Teo Iliadis

unread,
Sep 14, 2014, 10:39:40 AM9/14/14
to omn...@googlegroups.com
Hello, 

I am trying to use thruputMeter in the Inet Framework 2.4.0 but it gives me this error: 
<!> Error in module (ThruputMeter) Net80211_control.host[0].thruputMeter_udp_tx (id=19) at event #7, t=0: check_and_cast(): cannot cast (cMessage *)Net80211_control.host[0].thruputMeter_udp_tx.RegisterProtocol to type 'cPacket *'.

the console gives me this :
undisposed object: (cMessage) Net80211_control.host[0].thruputMeter_udp_tx.RegisterProtocol -- check module destructor

I am trying to use it between the networkLayer and the udp modules as the pictures show. I have tryed to to use all the gates of Network Layer  ifIn[]-ifOut[] ; transportIn[]-transportOut[]; igmpIn-igmpOut but nothing. I have attached the necessary files. 
In Inet 2.2.0 I hadn't this problem. The difference was that the networkLayer had udpIn/Out gates. 
Please give me some help, I've seen many people having similar problems. I've tryed some suggestions about dynamic cast in the .cc code of thruputmeter but nothing.  

Thanks in advance for your help.

AdhocHost.ned.txt
AdhocHost.ned_pic.jpg

Alfonso Ariza Quintana

unread,
Sep 15, 2014, 3:52:18 AM9/15/14
to omn...@googlegroups.com

void ThruputMeter::handleMessage(cMessage *msg)

{

updateStats(simTime(), PK(msg)->getBitLength());

send(msg, "out");

}

 

Change to

 

void ThruputMeter::handleMessage(cMessage *msg)

{

if (dynamic_cast<cPacket*>(msg))

     updateStats(simTime(), PK(msg)->getBitLength());

send(msg, "out");

}

--
You received this message because you are subscribed to the Google Groups "omnetpp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Teo Iliadis

unread,
Sep 15, 2014, 4:56:35 AM9/15/14
to omn...@googlegroups.com, aari...@hotmail.com
It works !!

So,that's how we can do dynamic cast in Omnet. 
Thank you very much mr. Alfonso!

Regards.
Teo

saif alani

unread,
Jun 29, 2015, 6:30:28 PM6/29/15
to omn...@googlegroups.com
hello friend kindly i would like to tell me how you solved (throughput meter ) problem , cause i'm new in omnet++ .
and when can i put this code:

void ThruputMeter::handleMessage(cMessage *msg)

{

if (dynamic_cast<cPacket*>(msg))

     updateStats(simTime(), PK(msg)->getBitLength());

send(msg, "out");

}

best regrades for you.

Alfonso Ariza Quintana

unread,
Jun 30, 2015, 4:03:04 AM6/30/15
to omn...@googlegroups.com

void ThruputMeter::handleMessage(cMessage *msg)

{

   cPacket *pkt = dynamic_cast<cPacket*>(msg);

  if (pkt) updateStats(simTime(), pkt->getBitLength());

   send(msg, "out");

}

--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.


To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.

chitsu...@gmail.com

unread,
Jan 14, 2016, 12:05:07 AM1/14/16
to OMNeT++ Users, aari...@hotmail.com
Hi Every body!
I wanna to measure throughput of TCP in mobile Ad-hoc Network.
Now I test TCP sack using std host with ThruputMeter .
I have added thruputMeter In stdhost but I get avg throughput 0.0.
How can i do?
Please give me some advice.
the folloving are tcpscak ned and ini file in Inetmanet 2.0/example/int/tcpsack
///////////////////////////////////////

//
// author: Thomas Reschka
//

package inet.examples.inet.tcpsack;

import inet.networklayer.autorouting.ipv4.IPv4NetworkConfigurator;
import inet.nodes.inet.Router;
import inet.nodes.inet.StandardHost;
import ned.DatarateChannel;


network tcpsack
{
    parameters:
        @display("bgb=400,200");
    submodules:
        router: Router {
            parameters:
                @display("p=200,100;i=abstract/router");
            gates:
                pppg[2];
        }
        client: StandardHost {
            parameters:
                @display("p=50,100");
            gates:
                pppg[1];
        }
        server: StandardHost {
            parameters:
                @display("p=350,100;i=device/server");
            gates:
                pppg[1];
        }
        configurator: IPv4NetworkConfigurator;
    connections:
        router.pppg[0] <--> NormalPath <--> client.pppg[0];
        router.pppg[1] <--> NormalPath <--> server.pppg[0];
}

channel NormalPath extends DatarateChannel
{
    parameters:
        datarate = 100Mbps;
        delay = 0.0565us; // 10m
        per = 0;
        ber = 0;
}
////////////////////////////////

[General]
network = tcpsack

warnings = true
sim-time-limit = 2.1s

cmdenv-module-messages = true # for normal (non-express) mode only
cmdenv-event-banners = true   # for normal (non-express) mode only

tkenv-plugin-path = ../../../etc/plugins

#
# Network specific settings
#

# set inet_addr, Mask, MTU ( = 1500), default route (=router)
#**.client.routingFile = "client.mrt"
#**.router.routingFile = "router.mrt"
#**.server.routingFile = "server.mrt"

# ip settings
**.ip.procDelay = 0s
**.IPForward = false

# hookType settings
**.ppp[*].numOutputHooks = 1
**.ppp[*].outputHook[0].typename = "OrdinalBasedDropper" # Nop | ThruputMeter | OrdinalBasedDropper | OrdinalBasedDuplicator

# ARP settings
**.arp.retryTimeout = 1s
**.arp.retryCount = 3
**.arp.cacheTimeout = 100s

# NIC settings
**.ppp[*].queueType = "DropTailQueue"
**.ppp[*].queue.frameCapacity = 100    # packets

# tcp apps - client
**.client.numTcpApps = 1
**.client.tcpApp[*].typename = "TCPSessionApp"  # FTP
**.client.tcpApp[*].sendBytes = 100MiB
**.client.tcpApp[*].active = true
#**.client.tcpApp[*].localAddress = "172.0.0.1"
**.client.tcpApp[*].localPort = 10020
**.client.tcpApp[*].connectAddress = "server"
**.client.tcpApp[*].connectPort = 10021
**.client.tcpApp[*].tOpen = 0s
**.client.tcpApp[*].tSend = 0s
**.client.tcpApp[*].tClose = 0s
**.client.tcpApp[*].sendScript = ""

# tcp apps - server
**.server.numTcpApps = 1
**.server.tcpApp[*].typename = "TCPSinkApp"
#**.server.tcpApp[*].localAddress = "172.0.1.111"
**.server.tcpApp[*].localPort = 10021

# tcp settings
**.tcpType = "TCP"
**.tcp.advertisedWindow = 65535                      # in bytes, corresponds with the maximal receiver buffer capacity (Note: normally, NIC queues should be at least this size)
**.tcp.delayedAcksEnabled = false                    # delayed ACK algorithm (RFC 1122) enabled/disabled
**.tcp.nagleEnabled = true                           # Nagle's algorithm (RFC 896) enabled/disabled
**.tcp.limitedTransmitEnabled = false                # Limited Transmit algorithm (RFC 3042) enabled/disabled (can be used for TCPReno/TCPTahoe/TCPNewReno/TCPNoCongestionControl)
**.tcp.increasedIWEnabled = false                    # Increased Initial Window (RFC 3390) enabled/disabled
**.tcp.sackSupport = true                            # Selective Acknowledgment (RFC 2018, 2883, 3517) support (header option) (SACK will be enabled for a connection if both endpoints support it)
**.tcp.windowScalingSupport = false                  # Window Scale (RFC 1323) support (header option) (WS will be enabled for a connection if both endpoints support it)
**.tcp.timestampSupport = false                      # Timestamps (RFC 1323) support (header option) (TS will be enabled for a connection if both endpoints support it)
**.tcp.mss = 500                                     # Maximum Segment Size (RFC 793) (header option)
**.tcp.tcpAlgorithmClass = "TCPReno"                 # TCPReno/TCPTahoe/TCPNewReno/TCPNoCongestionControl/DumbTCP
**.tcp.recordStats = true                            # recording of seqNum etc. into output vectors enabled/disabled

# pcapRecorder settings
**.numPcapRecorders = 1

#
# Config specific settings
#

# Examples from [RFC2018]:
#   "Assume the left window edge is 5000 and that the data transmitter
#   sends a burst of 8 segments, each containing 500 data bytes." [RFC2018]

[Config One]
description = "RFC_2018_Case_1"
**.client.pcapRecorder[0].pcapFile = "RFC_2018_Case_1_Client_Log.pcap"
**.server.pcapRecorder[0].pcapFile = "RFC_2018_Case_1_Server_Log.pcap"
**.client.ppp[*].outputHook[0].dropsVector = "17;18;19;20;"
#      "Case 1: The first 4 segments are received but the last 4 are
#      dropped.
#
#      The data receiver will return a normal TCP ACK segment
#      acknowledging sequence number 7000, with no SACK option." [RFC2018]

[Config Two]
description = "RFC_2018_Case_2"
**.client.pcapRecorder[0].pcapFile = "RFC_2018_Case_2_Client_Log.pcap"
**.server.pcapRecorder[0].pcapFile = "RFC_2018_Case_2_Server_Log.pcap"
**.client.ppp[*].outputHook[0].dropsVector = "13;"
#      "Case 2:  The first segment is dropped but the remaining 7 are
#      received.
#
#         Upon receiving each of the last seven packets, the data
#         receiver will return a TCP ACK segment that acknowledges
#         sequence number 5000 and contains a SACK option specifying
#         one block of queued data:
#
#             Triggering    ACK      Left Edge   Right Edge
#             Segment
#
#             5000         (lost)
#             5500         5000     5500       6000
#             6000         5000     5500       6500
#             6500         5000     5500       7000
#             7000         5000     5500       7500
#             7500         5000     5500       8000
#             8000         5000     5500       8500
#             8500         5000     5500       9000" [RFC2018]

[Config Three]
description = "RFC_2018_Case_3"
**.client.pcapRecorder[0].pcapFile = "RFC_2018_Case_3_Client_Log.pcap"
**.server.pcapRecorder[0].pcapFile = "RFC_2018_Case_3_Server_Log.pcap"
**.client.ppp[*].outputHook[0].dropsVector = "14;16;18;20;"
#      "Case 3:  The 2nd, 4th, 6th, and 8th (last) segments are
#      dropped.
#
#      The data receiver ACKs the first packet normally.  The
#      third, fifth, and seventh packets trigger SACK options as
#      follows:
#
#          Triggering  ACK    First Block   2nd Block     3rd Block
#          Segment            Left   Right  Left   Right  Left   Right
#                             Edge   Edge   Edge   Edge   Edge   Edge
#
#          5000       5500
#          5500       (lost)
#          6000       5500    6000   6500
#          6500       (lost)
#          7000       5500    7000   7500   6000   6500
#          7500       (lost)
#          8000       5500    8000   8500   7000   7500   6000   6500
#          8500       (lost)" [RFC2018]


# Examples from [RFC2883]:
#
#     "Reporting Full Duplicate Segments
#
#   We illustrate these guidelines with three examples.  In each example,
#   we assume that the data receiver has first received eight segments of
#   500 bytes each, and has sent an acknowledgement with the cumulative
#   acknowledgement field set to 4000 (assuming the first sequence number
#   is zero).  The D-SACK block is underlined in each example." [RFC2883]

[Config Four]
description = "RFC_2883_Example_1"
**.client.pcapRecorder[0].pcapFile = "RFC_2883_Example_1_Client_Log.pcap"
**.server.pcapRecorder[0].pcapFile = "RFC_2883_Example_1_Server_Log.pcap"
**.tcp.advertisedWindow = 1000
**.server.ppp[*].outputHook[0].dropsVector = "8;9;"
#    "Example 1: Reporting a duplicate segment.
#
#   Because several ACK packets are lost, the data sender retransmits
#   packet 3000-3499, and the data receiver subsequently receives a
#   duplicate segment with sequence numbers 3000-3499.  The receiver
#   sends an acknowledgement with the cumulative acknowledgement field
#   set to 4000, and the first, D-SACK block specifying sequence numbers
#   3000-3500.
#
#        Transmitted    Received    ACK Sent
#        Segment        Segment     (Including SACK Blocks)
#
#        3000-3499      3000-3499   3500 (ACK dropped)
#        3500-3999      3500-3999   4000 (ACK dropped)
#        3000-3499      3000-3499   4000, SACK=3000-3500
#                                              ---------" [RFC2883]

[Config Five]
description = "RFC_2883_Example_2"
**.client.pcapRecorder[0].pcapFile = "RFC_2883_Example_2_Client_Log.pcap"
**.server.pcapRecorder[0].pcapFile = "RFC_2883_Example_2_Server_Log.pcap"
**.tcp.advertisedWindow = 2000
**.client.ppp[*].outputHook[0].dropsVector = "11;"
**.server.ppp[*].outputHook[0].dropsVector = "8;9;10;"
#    "Example 2:  Reporting an out-of-order segment and a duplicate
#        segment.
#
#   Following a lost data packet, the receiver receives an out-of-order
#   data segment, which triggers the SACK option as specified in  RFC
#   2018.  Because of several lost ACK packets, the sender then
#   retransmits a data packet.  The receiver receives the duplicate
#   packet, and reports it in the first, D-SACK block:
#
#        Transmitted    Received    ACK Sent
#        Segment        Segment     (Including SACK Blocks)
#
#        3000-3499      3000-3499   3500 (ACK dropped)
#        3500-3999      3500-3999   4000 (ACK dropped)
#        4000-4499      (data packet dropped)
#        4500-4999      4500-4999   4000, SACK=4500-5000 (ACK dropped)
#        3000-3499      3000-3499   4000, SACK=3000-3500, 4500-5000
#                                                 ---------" [RFC2883]

[Config Six]
description = "RFC_2883_Example_3"
**.client.pcapRecorder[0].pcapFile = "RFC_2883_Example_3_Client_Log.pcap"
**.server.pcapRecorder[0].pcapFile = "RFC_2883_Example_3_Server_Log.pcap"
**.client.ppp[*].numOutputHooks = 2
**.client.ppp[*].outputHook[0].typename = "OrdinalBasedDropper" # Nop | ThruputMeter | OrdinalBasedDropper | OrdinalBasedDuplicator | ...
**.client.ppp[*].outputHook[0].dropsVector = "11;"
**.client.ppp[*].outputHook[1].typename = "OrdinalBasedDuplicator" # Nop | ThruputMeter | OrdinalBasedDropper | OrdinalBasedDuplicator | ...
**.client.ppp[*].outputHook[1].duplicatesVector = "12;"
#    "Example 3:  Reporting a duplicate of an out-of-order segment.
#
#   Because of a lost data packet, the receiver receives two out-of-order
#   segments.  The receiver next receives a duplicate segment for one of
#   these out-of-order segments:
#
#        Transmitted    Received    ACK Sent
#        Segment        Segment     (Including SACK Blocks)
#
#        3500-3999      3500-3999   4000
#        4000-4499      (data packet dropped)
#        4500-4999      4500-4999   4000, SACK=4500-5000
#        5000-5499      5000-5499   4000, SACK=4500-5500
#                       (duplicated packet)
#                       5000-5499   4000, SACK=5000-5500, 4500-5500
#                                              ---------" [RFC2883]


# References
#
#   [RFC2018]  Mathis, M., Mahdavi, J., Floyd, S. and Romanow, A., "TCP
#              Selective Acknowledgment Options", RFC 2018, October 1996.
#
#   [RFC2883]  Floyd, S., Mahdavi, J., Mathis, M. and Podolsky, M., "An
#              Extension to the Selective Acknowledgement (SACK) Option
#              for TCP", RFC 2883, July 2000.


Reply all
Reply to author
Forward
0 new messages