LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   find neighbors list in wireless senror network with ns2 simulator (https://www.linuxquestions.org/questions/linux-newbie-8/find-neighbors-list-in-wireless-senror-network-with-ns2-simulator-4175604161/)

asmab 04-19-2017 09:06 AM

find neighbors list in wireless senror network with ns2 simulator
 
hi everyone,i'm working on mac protocol for wsn, and i have to modify the smac protocol which exists already in ns2, i have two problems:
1)how to find the neighboring list of 2 hops.
2)how to work with the fonctions in ns2, are they defined in the ns2 library or we have to define every fonction? like in the exemple below:
class MAC {
void send (Packet* p);
void recv(Packet*, Handler* h);
NsObject* target_
what packet and handler are??
plzz help me its really urgent.
thank you

TB0ne 04-19-2017 09:13 AM

Quote:

Originally Posted by asmab (Post 5699197)
hi everyone,i'm working on mac protocol for wsn, and i have to modify the smac protocol which exists already in ns2, i have two problems:
1)how to find the neighboring list of 2 hops.
2)how to work with the fonctions in ns2, are they defined in the ns2 library or we have to define every fonction? like in the exemple below:
class MAC {
void send (Packet* p);
void recv(Packet*, Handler* h);
NsObject* target_
what packet and handler are??
plzz help me its really urgent.
thank you

Read the LQ Rules and the "Question Guidelines". Do not use text-speak, and bear in mind that everyone here is a volunteer, so asking for/expecting 'urgent' help is fairly rude...especially with your homework.

You've posted a few lines of a script, but not told us where you got it, or what you've done/tried on your own to do your assignment. Can you show us your code, and tell us where you're stuck??

asmab 04-19-2017 09:52 AM

i got these lines from a pdf that learns ns2 but it was not halpful.
these are some lines of what i did by myself but it doesnt work
#include <iostream>
#include <string>
#include<queue>
using namespace std;
const int maxqueue = 7;
struct queuetype
{
string name[maxqueue];
int priority;
int t_max;
int t_used;
};
struct datatype
{
int trafic_type;
int addrsrc;
int addrdst;
int duation;
};

int main()
{
queuetype<datatype> RT ;
queuetype<datatype> NRT1 ;
queuetype<datatype> NRT2 ;
}

TB0ne 04-19-2017 10:41 AM

Quote:

Originally Posted by asmab (Post 5699230)
i got these lines from a pdf that learns ns2 but it was not halpful. these are some lines of what i did by myself but it doesnt work
Code:

#include <iostream>
#include <string>
#include<queue>
using namespace std;
const int maxqueue = 7;
struct queuetype
{
 string name[maxqueue];
 int priority;
 int t_max;
 int t_used;
};
struct datatype
{
int trafic_type;
int addrsrc;
int addrdst;
int duation;
};

int main()
{
queuetype<datatype> RT ;
queuetype<datatype> NRT1 ;
queuetype<datatype> NRT2 ;
}


Please put code into CODE tags, and again, posting a VERY small piece of code and only saying "it was not halpful", tells us nothing. Where did you get the PDF? The code? What do you not understand about the documentation/code???? Which line(s) above are what you did yourself, and if you did modify the code in some way, why did you do it if you didn't understand what you were doing?

We can try to help, but again, we need DETAILS before we can do it.

knudfl 04-22-2017 03:55 PM

@asmab : Welcome to LQ.

ns2 wsn neighbor list : Some hints here ...
https://www.google.com/webhp?hl=all&...+neighbor+list
Example
http://stackoverflow.com/questions/1...hat-can-not-be


-


All times are GMT -5. The time now is 08:27 PM.