LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-19-2017, 09:06 AM   #1
asmab
LQ Newbie
 
Registered: Apr 2017
Posts: 2

Rep: Reputation: Disabled
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
 
Old 04-19-2017, 09:13 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by asmab View Post
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??
 
Old 04-19-2017, 09:52 AM   #3
asmab
LQ Newbie
 
Registered: Apr 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
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 ;
}
 
Old 04-19-2017, 10:41 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by asmab View Post
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.
 
Old 04-22-2017, 03:55 PM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
@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


-

Last edited by knudfl; 04-22-2017 at 04:00 PM.
 
  


Reply

Tags
ns2



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Network simulator (NS2) rohitdaid Linux - Software 0 11-11-2013 09:24 PM
to find neighbors of a node in sensor network in LEACH protocol Tellajeera Sushma Linux - Networking 0 02-05-2012 03:14 AM
ns2- network simulator problem vivekr Linux - Networking 5 02-16-2011 12:25 PM
Installing NS2.26 (Network Simulator) Error:can't find X library linuxsimulationboy Debian 3 07-13-2008 02:41 AM
NS2 - network simulator liquid.o Linux - Networking 0 11-24-2006 10:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration