Hello,
I have tried to play around with the Third example from the the tutorials. I have managed to define two interfaces, two channels, two addresses for each node, and assigned different frequencies for each channel.
I know so far that the server can not be installed on the node using the node interface address, while it is possible when I will install client, as illustrated by the example.
UdpEchoServerHelper echoServer (44);
ApplicationContainer serverApps = echoServer.Install (wifiStaNodes.Get (0));
serverApps.Start (Seconds (0.0));
serverApps.Stop (Seconds (10.0));
UdpEchoClientHelper echoClient (wifiInterfaces.GetAddress (0), 44);
echoClient.SetAttribute ("MaxPackets", UintegerValue (10));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (0.0)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
Instead, I have tried to install two Servers with different port numbers as the following, but it seems that they do not work simultaneously.
Ipv4AddressHelper address;
address.SetBase ("1.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer wifiInterfaces;
wifiInterfaces = address.Assign (staDevices);
address.SetBase ("2.2.2.0", "255.255.255.0");
Ipv4InterfaceContainer wifiInterfacesx;
wifiInterfacesx = address.Assign (staDevicesx);
UdpEchoServerHelper echoServer (44);
ApplicationContainer serverApps = echoServer.Install (wifiStaNodes.Get (0));
serverApps.Start (Seconds (0.0));
serverApps.Stop (Seconds (10.0));
UdpEchoClientHelper echoClient (wifiInterfaces.GetAddress (0), 44);
echoClient.SetAttribute ("MaxPackets", UintegerValue (10));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (0.0)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientApps = echoClient.Install (wifiStaNodes.Get (nWifi-1));
clientApps.Start (Seconds (0.0));
clientApps.Stop (Seconds (10.0));
UdpEchoServerHelper echoServerx (55);
ApplicationContainer serverAppsx = echoServerx.Install (wifiStaNodes.Get (0));
serverApps.Start (Seconds (0.0));
serverApps.Stop (Seconds (10.0));
UdpEchoClientHelper echoClientx (wifiInterfacesx.GetAddress (0), 55);
echoClientx.SetAttribute ("MaxPackets", UintegerValue (10));
echoClientx.SetAttribute ("Interval", TimeValue (Seconds (0.0)));
echoClientx.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientAppsx = echoClientx.Install (wifiStaNodes.Get (nWifi-1));
clientAppsx.Start (Seconds (0.0));
clientAppsx.Stop (Seconds (10.0));
Could anybody please comment on this
Regards
Jakub
Hello,
I have tried to play around with the Third example from the the tutorials. I have managed to define two interfaces, two channels, two addresses for each node, and assigned different frequencies for each channel.
I know so far that the server can not be installed on the node using the node interface address, while it is possible when I will install client, as illustrated by the example.
Thank you for the clarification. some times miss-expressing the problem bring up more clear explanation.
I am using ns-3.22 which is also my first version I use:
and I modified the third.cc as following:
#include "ns3/core-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/wifi-module.h"
#include "ns3/mobility-module.h"
#include "ns3/csma-module.h"
#include "ns3/internet-module.h"
#include "ns3/wifi-net-device.h" // OYunadded
#include "ns3/names.h"
#include "ns3/ocb-wifi-mac.h"
#include "ns3/wifi-80211p-helper.h"
#include "ns3/wave-mac-helper.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("ThirdScriptExample");
int
main (int argc, char *argv[])
{
bool verbose = true;
// uint32_t nCsma = 3;
uint32_t nWifi = 3;
CommandLine cmd;
// cmd.AddValue ("nCsma", "Number of \"extra\" CSMA nodes/devices", nCsma);
cmd.AddValue ("nWifi", "Number of wifi STA devices", nWifi);
cmd.AddValue ("verbose", "Tell echo applications to log if true", verbose);
cmd.Parse (argc,argv);
if (nWifi > 18)
{
std::cout << "Number of wifi nodes " << nWifi <<
" specified exceeds the mobility bounding box" << std::endl;
exit (1);
}
if (verbose)
{
LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);
}
NodeContainer wifiStaNodes;
wifiStaNodes.Create (nWifi);
// YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
YansWifiChannelHelper Channel = YansWifiChannelHelper::Default ();
YansWifiChannelHelper Channelx = YansWifiChannelHelper::Default ();
YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
YansWifiPhyHelper phyx = YansWifiPhyHelper::Default ();
Ptr<YansWifiChannel> channel = Channel.Create ();
phy.SetChannel (channel);
// phy.Set("ChannelNumber",UintegerValue(1));
phy.Set ("Frequency", UintegerValue (900));
Ptr<YansWifiChannel> channelx = Channelx.Create ();
phyx.SetChannel (channelx);
phyx.Set ("Frequency", UintegerValue (700));
Wifi80211pHelper wifi = Wifi80211pHelper::Default ();
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode",StringValue ("OfdmRate6MbpsBW10MHz"),
"NonUnicastMode",StringValue ("OfdmRate6MbpsBW10MHz"),
"ControlMode",StringValue ("OfdmRate6MbpsBW10MHz"));
Wifi80211pHelper wifix = Wifi80211pHelper::Default ();
wifix.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode",StringValue ("OfdmRate6MbpsBW10MHz"),
"NonUnicastMode",StringValue ("OfdmRate6MbpsBW10MHz"),
"ControlMode",StringValue ("OfdmRate6MbpsBW10MHz"));
QosWaveMacHelper mac = QosWaveMacHelper::Default ();
QosWaveMacHelper macx = QosWaveMacHelper::Default ();
NetDeviceContainer staDevices;
staDevices = wifi.Install (phy, mac, wifiStaNodes);
NetDeviceContainer staDevicesx;
staDevicesx = wifi.Install (phyx, macx, wifiStaNodes);
MobilityHelper mobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
"MinX", DoubleValue (0.0),
"MinY", DoubleValue (0.0),
"DeltaX", DoubleValue (5.0),
"DeltaY", DoubleValue (10.0),
"GridWidth", UintegerValue (3),
"LayoutType", StringValue ("RowFirst"));
mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
"Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
mobility.Install (wifiStaNodes);
InternetStackHelper stack;
stack.Install (wifiStaNodes);
Ipv4AddressHelper address;
address.SetBase ("1.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer wifiInterfaces;
wifiInterfaces = address.Assign (staDevices);
address.SetBase ("2.2.2.0", "255.255.255.0");
Ipv4InterfaceContainer wifiInterfacesx;
wifiInterfacesx = address.Assign (staDevicesx);
UdpEchoServerHelper echoServer (44);
ApplicationContainer serverApps = echoServer.Install (wifiStaNodes.Get (0));
serverApps.Start (Seconds (0.0));
serverApps.Stop (Seconds (10.0));
UdpEchoClientHelper echoClient (wifiInterfaces.GetAddress (0), 44);
echoClient.SetAttribute ("MaxPackets", UintegerValue (10));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (0.0)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientApps = echoClient.Install (wifiStaNodes.Get (nWifi-1));
clientApps.Start (Seconds (0.0));
clientApps.Stop (Seconds (10.0));
UdpEchoServerHelper echoServerx (55);
ApplicationContainer serverAppsx = echoServerx.Install (wifiStaNodes.Get (0));
serverApps.Start (Seconds (0.0));
serverApps.Stop (Seconds (10.0));
UdpEchoClientHelper echoClientx (wifiInterfacesx.GetAddress (0), 55);
echoClientx.SetAttribute ("MaxPackets", UintegerValue (10));
echoClientx.SetAttribute ("Interval", TimeValue (Seconds (0.0)));
echoClientx.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientAppsx = echoClientx.Install (wifiStaNodes.Get (nWifi-1));
clientAppsx.Start (Seconds (0.0));
clientAppsx.Stop (Seconds (10.0));
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
Simulator::Stop (Seconds (10.0));
AsciiTraceHelper ascii;
phy.EnableAsciiAll(ascii.CreateFileStream("wiii.tr"));
Simulator::Run ();
Simulator::Destroy ();
return 0;
}
Thank you
Jakub
--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.
echoClient.SetAttribute ("Interval", TimeValue (Seconds (0.0)));
clientApps.Start (Seconds (0.0));
clientApps.Stop (Seconds (10.0));
At time 1s client sent 1024 bytes to 1.1.1.1 port 44
At time 1s client sent 1024 bytes to 2.2.2.1 port 55
At time 1.00817s server received 1024 bytes from 1.1.1.2 port 49153
At time 1.00817s server sent 1024 bytes to 1.1.1.2 port 49153
At time 1.0103s server received 1024 bytes from 2.2.2.2 port 49154
At time 1.0103s server sent 1024 bytes to 2.2.2.2 port 49154
At time 1.01331s client received 1024 bytes from 1.1.1.1 port 44
At time 1.02144s client received 1024 bytes from 2.2.2.1 port 55
Sorry for being buggy here, but I am trying to understand a fundamental issue regarding Redundancy.
When I am sending more than one packet, there is no delay in receiving any packet after the first one, but there is always presented delay with the first packet arrival? Do I miss something here ?
Thank you'r comments.
At time 1s client sent 1024 bytes to 1.1.1.1 port 44
At time 1s client sent 1024 bytes to 2.2.2.1 port 55
At time 1.00817s server received 1024 bytes from 1.1.1.2 port 49153
At time 1.00817s server sent 1024 bytes to 1.1.1.2 port 49153
At time 1.0103s server received 1024 bytes from 2.2.2.2 port 49154
At time 1.0103s server sent 1024 bytes to 2.2.2.2 port 49154
At time 1.01331s client received 1024 bytes from 1.1.1.1 port 44 --------------- 1st Packet reception delay on the two interfaces ??
At time 1.02144s client received 1024 bytes from 2.2.2.1 port 55
At time 2s client sent 1024 bytes to 1.1.1.1 port 44
At time 2s client sent 1024 bytes to 2.2.2.1 port 55
At time 2.0015s server received 1024 bytes from 1.1.1.2 port 49153
At time 2.0015s server sent 1024 bytes to 1.1.1.2 port 49153
At time 2.0015s server received 1024 bytes from 2.2.2.2 port 49154
At time 2.0015s server sent 1024 bytes to 2.2.2.2 port 49154
At time 2.00324s client received 1024 bytes from 1.1.1.1 port 44 ---------------No Delay for the second Packet
At time 2.00324s client received 1024 bytes from 2.2.2.1 port 55
echoClient.SetAttribute ("Interval", TimeValue (MilliSeconds (1.0)));
...