hello 

First of all thanks to Mr. Timo, for his help regarding sendmsg().

As I wanted to see the data that i set in the tcl file, I edited the
../tcl/ex/udpdata.tcl like


$ns at 0.1 "$udp0 send 724 Hello1"
$ns at 0.2 "$udp1 send 100 Hello2"
$ns at 0.3 "$udp0 send 500 Hello3"
$ns at 0.4 "$udp1 send 828 Hello4"

It calls the following function in udp.cc, where i added the printf
statement

int UdpAgent::command(int argc, const char*const* argv)
{
        if (argc == 4) {
                if (strcmp(argv[1], "send") == 0) {
                        printf("\n \n%d==>%s",atoi(argv[2]),argv[3]);
                        PacketData* data = new PacketData(1 + strlen(argv[3]));
                        strcpy((char*)data->data(), argv[3]);
                        sendmsg(atoi(argv[2]), data);
                        return (TCL_OK);
                }

Its displaying the contents of data, as expected. But after this, when i add
printf statement in "void UdpAgent::sendmsg(int nbytes, AppData* data, const
char* flags)" ,like given below

if (flags && (0 ==strcmp(flags, "NEW_BURST")))
                        rh->flags() |= RTP_M;
                p->setdata(data);

                printf("after setdata(): %s :",p->userdata());

                target_->recv(p);

and at receiver end, i did the same, like


void UdpAgent::recv(Packet* pkt, Handler*)
{
//      printf("\n userdata():%s", pkt->userdata());
        printf("\nData:::%s",pkt->userdata());
        printf("\n In UdpAgent::recv(Packet* pkt, Handler*)");
        if (app_ ) {


Now in both cases, its displaying either null or some garbage value.
what is the problem here? 
Any little help will be greatly appreciated.

thanks,
Anuradha
-- 
View this message in context: 
http://www.nabble.com/regarding-sendmsg%28%29-tf3678871.html#a10280718
Sent from the ns-users mailing list archive at Nabble.com.

Reply via email to