The ns3 project has serveral examples on how to make ns3 interact with real world through tap. A raw socket was created in FdNetDevice for that purpose. It is convenient to test new tcp congestion protocol. The raw socket will receive all the packets with the destionation that it binded.
In my case, I just want to make the ns3 application handle the udp packet without bothering to process the Ethernet header.
In future, the project may have some use in testing rtp protocol.
+++++++++++| +++++++++++|
|udp client| |udp server|
+++++++++++| +++++++++++|
\ /
\ ns3 simulation environment /
\___|fd|node0------node1|fd|____/
And the code can be downloaded at[1].
[1]ns3-udp