Hi Tommaso,
thank you for reply.
Your guess is right. I need to process packet headers and payloads. For the beginning and for some simplification, I have random data generated by OnOff application. In my scenario I use PacketSink on receiver side for reception both TCP and UDP traffic, so I guess UdpServer is not exactly what I need. I did some research in reference manual and I guess some of that could be done via packet printing. (It's interesting what can you find in documentation if you spend hours on finding sth you don't exactly know what! :)). I found out that I could possibly copy data from packet and store it wherever I need. Since I'm new to NS3 and OO programming, I'm not sure how to make it work. I've found this piece of code based on CopyDatamethod in another topic:
sender side:
uint8_t buffer[1012];
for(int i=0;i<1012;i++){
buffer[i]=85;
}
std::cout << "user data" << std::endl;
for(int i=0;i<1012;i++){
std::cout << (uint8_t)buffer[i]; //<< std::endl;
}
std::cout << std::endl;
Ptr<Packet> p = Create<Packet> (buffer, m_size-(8+4));
receiver side:
uint8_t *buffer_temp=new uint8_t[1013];
packet->CopyData(buffer_temp,1012);
for(int i=0;i<1012;i++){
std::cout << *buffer_temp;
buffer_temp++;
}
I am missing the point of inserting value 85 and dont know what should this line do(Ptr<Packet> p = Create<Packet> (buffer, m_size-(8+4));).
I went ahead and searched packet.h and buffer.h, but I'm obviously missing something. I see I need to copy incomming packets into temporary variable and redirect it into my database. Can you please tell me if am I on a right way and help me a bit with a code?
My scenario is as follows:
http://pastebin.com/2MgwFNqn#Thank you very much.
V