How to send Data throught wireless network

100 views
Skip to first unread message

Oussama El Ansari

unread,
Jun 9, 2022, 1:06:44 AM6/9/22
to OMNeT++ Users
Hello guys I'm new to OMNET++ and I've just tested this tutorial on making to wireless hosts communicate and I can see that the packet being sent is defined here
*.hostA.app[0].packetName = "UDPData"
How can I change this to be a variable that I have in my .cc files ? and once I receive it in my host how can I read/manipulate it ?

Thank you for ur help

Alfonso Ariza Quintana

unread,
Jun 9, 2022, 3:37:52 AM6/9/22
to omn...@googlegroups.com
In the code, you can change the name of any packet using setName metho
myPkt->setName("NewName");

De: omn...@googlegroups.com <omn...@googlegroups.com> en nombre de Oussama El Ansari <elansa...@gmail.com>
Enviado: jueves, 9 de junio de 2022 7:06
Para: OMNeT++ Users <omn...@googlegroups.com>
Asunto: [Omnetpp-l] How to send Data throught wireless network
 
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/omnetpp/45dc47bd-81ce-4687-bee5-fe13b300e636n%40googlegroups.com.

Oussama El Ansari

unread,
Jun 9, 2022, 8:10:24 AM6/9/22
to OMNeT++ Users

First of all thank u for ur help, what if I wanted to change the app on the application layer? What's the best way to do that because it doesn't seem like modifying UdpBasicApp.cc is a good idea. 
Message has been deleted

Oussama El Ansari

unread,
Jun 9, 2022, 11:38:41 PM6/9/22
to OMNeT++ Users
And can u provide me with more explanation on how to use the setName method plz ? let's say I have another module and in its .cc file I have the Data String that I want to send through the wireless network how do I pass this string to  *.hostA.app[0].packetName instead of "UDPData" ?

Thank you 

Alfonso Ariza Quintana

unread,
Jun 10, 2022, 3:35:02 AM6/10/22
to omn...@googlegroups.com
You can derive the class, MyUdpBasicApp : public UdpBasicApp {
}

and create your application with your necessities

Enviado: jueves, 9 de junio de 2022 14:10
Para: OMNeT++ Users <omn...@googlegroups.com>
Asunto: Re: [Omnetpp-l] How to send Data throught wireless network
 

Oussama El Ansari

unread,
Jun 10, 2022, 5:24:29 AM6/10/22
to OMNeT++ Users
but how do I connect it to the transport's layer's udp ? because modifying the .ini file to *.hostA.app[0].typename = "MyUdpBasicApp" doesn't work and gives an error (I created a new module with a new .ned file)

Alfonso Ariza Quintana

unread,
Jun 10, 2022, 6:01:44 AM6/10/22
to omn...@googlegroups.com
It is not enough with the ned file, you also need to create the cc file and include the Define_Module(MyUdpBasicApp);



Enviado: viernes, 10 de junio de 2022 11:24
Message has been deleted
Message has been deleted
Message has been deleted

Oussama El Ansari

unread,
Jun 10, 2022, 6:42:48 AM6/10/22
to OMNeT++ Users
yes I did create the cc file (with the same code as UdpBasicApp to be sure there's no errors in it ) but when I change the .ini to *.hostA.app[0].typename = "MyUdpBasicApp" I still get an error.

Thank u

Alfonso Ariza Quintana

unread,
Jun 10, 2022, 7:27:44 AM6/10/22
to omn...@googlegroups.com
With this is information quite impossible to determine the problem

Enviado: viernes, 10 de junio de 2022 12:42

Oussama El Ansari

unread,
Jun 10, 2022, 9:23:20 AM6/10/22
to OMNeT++ Users
First of all thank u for trying to help ^_^
My goal is to change the app on the application layer with my own module I've succeed on changing it by extending the WirelessHost like this :

module node extends WirelessHost{
 
  submodules :
              MyApp: ROSForwarderApplication {
            @display("i=misc/node_vs;p=496.12802,63.104");
        }
        connections allowunconnected:
 
           MyApp.lower802154LayerOut --> at.in++;
          MyApp.lower802154LayerIn <-- at.out++;

}
Screenshot from 2022-06-10 15-20-22.png

now I can successfully see the UGV submodule on the application layer connected to the transport layer,  I'm having problems now on sending the packet from MyApp to UDP, I have a string in ROSForwarderApplication.cpp and I don't know how to send it to the udp any help will be appreciated.

Alfonso Ariza Quintana

unread,
Jun 16, 2022, 5:16:58 AM6/16/22
to omn...@googlegroups.com
But what message do you have?
It is possible that you could have a problem with the namespaces


Enviado: viernes, 10 de junio de 2022 12:13

Para: OMNeT++ Users <omn...@googlegroups.com>
Asunto: Re: [Omnetpp-l] How to send Data throught wireless network
 
Yes that's what I did ... I created MyUdpBasicApp.cc/.h/.ned in my project with basically the same code as UdpBasicApp (to be sure there's no errors in the code) but when I do *.hostA.app[0].typename = "MyUdpBasicApp" I still get an error saying no module type named "MyUdpBasicApp" found.
but when i put the MyUdpBasicApp.cc/.h/.ned files in /src/inet/applications/upd  *.hostA.app[0].typename = "MyUdpBasicApp" works fine any idea how can I fix this sir ? (have the MyUdpBasicApp.cc/.h/.ned in the same folder as my project) 

Omaima Younsi

unread,
Nov 16, 2022, 1:31:46 PM11/16/22
to OMNeT++ Users
Hello Oussema, 

I am trying to write another treatment in the app layer, can you please share how you called the app in the cpp file I am still a bit confused how to do the implementation in the cpp file.

Reply all
Reply to author
Forward
0 new messages