printing data from tcp file

44 views
Skip to first unread message

Srinath N

unread,
Mar 16, 2015, 4:45:34 PM3/16/15
to ns-3-...@googlegroups.com
hello
as part of my project, I am trying to create a new tcp variant and have named it tcpnew.cc for now. My questions is, how can I print any data that I define in the 'tcpnew.cc' file or is already defined in the 'tcpnew.cc' file and where can I find it? Will standard I/O commands work? More specifically, from the 'tcpnew.cc' file, can I read / print the simulator time of a program that uses this tcp variant? 
Thank you 

Konstantinos

unread,
Mar 16, 2015, 4:51:41 PM3/16/15
to ns-3-...@googlegroups.com
Please refer to the Logging section in the manual, it will be much easier to control it than std::cout.

Srinath N

unread,
Mar 17, 2015, 12:48:21 AM3/17/15
to ns-3-...@googlegroups.com

hello
I have learnt the logging procedures but still am unable to view even the unconditionally logged messages in the 'tcpnew.cc' file. The logging information in the file that uses the new tcp model, however, gets displayed when I run it.
What should I change?
thank you

Nat P

unread,
Mar 17, 2015, 4:23:06 AM3/17/15
to ns-3-...@googlegroups.com


Il giorno martedì 17 marzo 2015 05:48:21 UTC+1, Srinath N ha scritto:

hello
I have learnt the logging procedures but still am unable to view even the unconditionally logged messages in the 'tcpnew.cc' file. The logging information in the file that uses the new tcp model, however, gets displayed when I run it.
What should I change?
thank you

What is probably happening is that you are not using your tcp-new.cc . Try to insert a NS_FATAL_ERROR () in NewAck, and see if your program fails.

You need use Configure::SetDefault to set the default TCP for all sockets (yes, using two different types of socket in the same simulation is a pain, and I discovered how to do it only after months in ns-3).

Srinath N

unread,
Mar 18, 2015, 2:18:33 AM3/18/15
to ns-3-...@googlegroups.com
hello
yes i realised that It is not utilising the 'tcpnew.cc' file. The code is as follows. What must I change

std::string tcpModel ("ns3::TcpNew");
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue (tcpModel));
 Address sinkAddress1 (InetSocketAddress (csmaInterfaces.GetAddress (1), sinkPort));
  PacketSinkHelper packetSinkHelper1 ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), sinkPort));
  ApplicationContainer sinkApps1 = packetSinkHelper1.Install (csmaNodes.Get (1));
  sinkApps1.Start (Seconds (0.));
  sinkApps1.Stop (Seconds (10.));

  Ptr<Socket> ns3TcpSocket1 = Socket::CreateSocket (wifiStaNodes.Get (0), TcpSocketFactory::GetTypeId ());
  ns3TcpSocket1->TraceConnectWithoutContext ("CongestionWindow", MakeCallback (&CwndChange));


  Ptr<MyApp> app1 = CreateObject<MyApp> ();
  app1->Setup (ns3TcpSocket1, sinkAddress1, 1040, 1000, DataRate ("1Mbps"));
  wifiStaNodes.Get (0)->AddApplication (app1);
  app1->SetStartTime (Seconds (0.));
  app1->SetStopTime (Seconds (10.));


thank you!

Nat P

unread,
Mar 18, 2015, 6:06:38 AM3/18/15
to ns-3-...@googlegroups.com


Il giorno mercoledì 18 marzo 2015 07:18:33 UTC+1, Srinath N ha scritto:
hello
yes i realised that It is not utilising the 'tcpnew.cc' file. The code is as follows. What must I change



1) Configure::SetDefault should be set BEFORE the socket creation in the application (before the call to InternetStackHelper.Install())
2) You are creating a float-in-nowhere socket. You should put it in the application if you want to connect with the pointers like you are doing (no out-of-the box API to do this anyway)
3) Anyway, right now you need to create all the application, THEN connect through the Config subsystem the traces you need. Pseudocode:

Config::SetDefault
...
InternetStackHelper install All
...
CreateApplication
...
Connect Traces
...
Simulation start

Srinath N

unread,
Mar 18, 2015, 4:05:46 PM3/18/15
to ns-3-...@googlegroups.com

Thank you ! That was really helpful !

--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/OJSDFVYoH1s/unsubscribe.
To unsubscribe from this group and all its topics, 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.
Reply all
Reply to author
Forward
0 new messages