[ns] Nodes not receiving broadcast message
Hi Mukaka and all, try to add this ch->direction() = hdr_cmn::DOWN; ch->next_hop() = MAC_BROADCAST; Sidney Doria 2008/3/12, Nur Aini Rakhmawati <[EMAIL PROTECTED]>: > > in my protocol code, the addr_type is NS_AF_INET > I define the port number as well > here is my broadcast code : > > http://nuraini.net/2007/09/16/unicast-and-broadcat-packet-on-ns2/ > > it works for me :) > > --- > Nur Aini Rakhmawati > Touch the sky, Down to the earth > http://nuraini.net/ > > - Original Message > From: SS Mukaka <[EMAIL PROTECTED]> > To: ns-users@ISI.EDU > Sent: Tuesday, March 11, 2008 10:16:50 PM > Subject: [ns] Nodes not receiving broadcast message > > > I want to send a broadcast message to neighbours I'm having a problem > because the nodes are not receiving the message if I put ih->daddr() = > IP_BROADCAST; > I have tested it by putting ih->daddr() = 1; and it worked... ie. node 1 was > able to receive the message.. Below is my code for sending and also for > receiving > > void ReQuest::sendREQUEST() > { > > Packet* p = Packet::alloc(); > struct hdr_cmn* ch = HDR_CMN(p); > struct hdr_ip* ih = HDR_IP(p); > struct hdr_MyPacket* ah = HDR_MyPacket(p); > ch->size() = IP_HDR_LEN + ah->size(); > ch->addr_type() = NS_AF_NONE; > > ih->daddr() = IP_BROADCAST; > ih->saddr() = index; > ah->MyPacket_type = ReQ; > Scheduler::instance().schedule(target_, p, 0.0); > } > > My receive function is as follows: > > void ReQuest::recv(Packet* p, Handler*) > { > struct hdr_cmn* ch = HDR_CMN(p); > struct hdr_ip* ih = HDR_IP(p); > struct hdr_MyPacket* ah = HDR_MyPacket(p); > nsaddr_t src = ih->saddr(); > printf("Node %d receiving data packet from %d \n", index, src); > > // processing packet > } > > like i said, nodes can only receive messages if i put the IP address of the > receipient but when i use IP_BROADCAST, nothing is received... > > Thank you in advance > > > > > > > > > Never miss a thing. Make Yahoo your home page. > http://www.yahoo.com/r/hs > > -- Sidney Doria Redes ad hoc móveis Mestrado em Computação UFCG Brasil "Nessa jornada, o conhecimento será o seu escudo..." (Mestre dos Magos no episódio do grimoire de ouro)
Re: [ns] Nodes not receiving broadcast message
in my protocol code, the addr_type is NS_AF_INET I define the port number as well here is my broadcast code : http://nuraini.net/2007/09/16/unicast-and-broadcat-packet-on-ns2/ it works for me :) --- Nur Aini Rakhmawati Touch the sky, Down to the earth http://nuraini.net/ - Original Message From: SS Mukaka <[EMAIL PROTECTED]> To: ns-users@ISI.EDU Sent: Tuesday, March 11, 2008 10:16:50 PM Subject: [ns] Nodes not receiving broadcast message I want to send a broadcast message to neighbours I'm having a problem because the nodes are not receiving the message if I put ih->daddr() = IP_BROADCAST; I have tested it by putting ih->daddr() = 1; and it worked... ie. node 1 was able to receive the message.. Below is my code for sending and also for receiving void ReQuest::sendREQUEST() { Packet* p = Packet::alloc(); struct hdr_cmn* ch = HDR_CMN(p); struct hdr_ip* ih = HDR_IP(p); struct hdr_MyPacket* ah = HDR_MyPacket(p); ch->size() = IP_HDR_LEN + ah->size(); ch->addr_type() = NS_AF_NONE; ih->daddr() = IP_BROADCAST; ih->saddr() = index; ah->MyPacket_type = ReQ; Scheduler::instance().schedule(target_, p, 0.0); } My receive function is as follows: void ReQuest::recv(Packet* p, Handler*) { struct hdr_cmn* ch = HDR_CMN(p); struct hdr_ip* ih = HDR_IP(p); struct hdr_MyPacket* ah = HDR_MyPacket(p); nsaddr_t src = ih->saddr(); printf("Node %d receiving data packet from %d \n", index, src); // processing packet } like i said, nodes can only receive messages if i put the IP address of the receipient but when i use IP_BROADCAST, nothing is received... Thank you in advance Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs
[ns] Nodes not receiving broadcast message
I want to send a broadcast message to neighbours I'm having a problem because the nodes are not receiving the message if I put ih->daddr() = IP_BROADCAST; I have tested it by putting ih->daddr() = 1; and it worked... ie. node 1 was able to receive the message.. Below is my code for sending and also for receiving void ReQuest::sendREQUEST() { Packet* p = Packet::alloc(); struct hdr_cmn* ch = HDR_CMN(p); struct hdr_ip* ih = HDR_IP(p); struct hdr_MyPacket* ah = HDR_MyPacket(p); ch->size() = IP_HDR_LEN + ah->size(); ch->addr_type() = NS_AF_NONE; ih->daddr() = IP_BROADCAST; ih->saddr() = index; ah->MyPacket_type = ReQ; Scheduler::instance().schedule(target_, p, 0.0); } My receive function is as follows: void ReQuest::recv(Packet* p, Handler*) { struct hdr_cmn* ch = HDR_CMN(p); struct hdr_ip* ih = HDR_IP(p); struct hdr_MyPacket* ah = HDR_MyPacket(p); nsaddr_t src = ih->saddr(); printf("Node %d receiving data packet from %d \n", index, src); // processing packet } like i said, nodes can only receive messages if i put the IP address of the receipient but when i use IP_BROADCAST, nothing is received... Thank you in advance