hello ns-users

I am having a problem in understanding a statement

$udp0 sendmsg 0 Hello 0 

It calls the sendmsg() function of UDPAgent class in udp.cc file, like,

if (strcmp(argv[1], "sendmsg") == 0) {

   PacketData* data = new PacketData(1 + strlen(argv[3]));
   strcpy((char*)data->data(), argv[3]);

  sendmsg(atoi(argv[2]), data, argv[4]);
   return (TCL_OK);
  }

It means its calling sendmsg() in backend.

But when i want to see the data_ (member variable of PacketData)value in
UDPAgent::sendmsg(), like,

void UdpAgent::sendmsg(int nbytes, PacketData* data, const char* flags)
{
 Packet *p;
 int n;
 printf("\n In UdpAgent::sendmsg():%d-->%s-->%s",nbytes,data->data(),flags);
//%s",(char *)data->data());
 assert (size_ > 0);


(In this code, the argument was AppData, that i changed to PacketData to
access the data_ field in  PacketData)
it shows me segmentation fault(core dumped), when i run the tcl script after
compilation of ns2.

I will really appreciate if any body can guide me about this a little bit.

Thanks a lot

Anuradha
-- 
View this message in context: 
http://www.nabble.com/-ns--regarding-segmentation-fault%28core-dumped%29-in-sendmsg%28%29-function-tf3674133.html#a10266551
Sent from the ns-users mailing list archive at Nabble.com.

Reply via email to