Using socket in omnet++

91 Views Asked by At

I am trying to send a packet from application layer at sender node directly to mac layer and then to a specific application at the receiver node.

 
*.S.numApps = 1
*.S.app[0].typename = "UdpSourceApp"
*.S.app[0].io.destAddress = "destination"
*.S.app[0].io.destPort = 1000
*.S.app[0].source.displayStringTextFormat = "sent %p pk (%l)"
*.S.app[0].source.packetLength = 1200B
*.S.app[0].source.productionInterval = truncnormal(100us,50us)

# destination application
*.R.numApps = 1
*.R.app[0].typename = "UdpSinkApp"
*.R.app[0].io.localPort = 1000
 

Error: handleMessage(): Unknown protocol: protocolId = 63, protocolName = udp, servicePrimitive = REQUEST, pathStartGate = NN.S.app[0].io.socketOut, pathEndGate = NN.S.sc.in[2] -- in module (inet::MessageDispatcher) NN.S.sc (id=12), during network initialization

Please give me an example of how I can send this packet to a specific application at the receiver node using only application/ mac and physical layers.

enter image description hereenter image description here

##################################

I also tried to use this, but the packet never arrived to the sink app. (please check the attached picture)

# source application
*.S.numApps = 1
*.S.app[0].typename = "EthernetSourceApp"
*.S.app[0].display-name = "source"

*.S.app[0].interfaceTable.displayAddresses = true
 
*.*.app[*].source.packetLength = 1B
*.*.app[*].source.productionInterval = 1ms  
*.*.app[*].sink.consumptionInterval  = 1ms  
 
 
 
# destination application
*.R.numApps = 1
*.R.app[0].typename = "EthernetSinkApp"
*.R.app[0].display-name = "dest"
 
 
1

There are 1 best solutions below

4
Rudi On

You are asking two questions in a single SO question... but:

  1. Yes, the error "Unknown protocol" is to be expected as you are sending an UDP packet on a node that does not have UDP or IP layers... This is essentially a switch, so only RAW ethernet packets should be sent. Which leads to the second part (this is a good direction,), but...
  2. I don't see anywhere in the INI file where you specified the destination address, where the packets should be sent, so no wonder they are not arriving.