diff -r 8e6ac6061680 examples/tcp-large-transfer.cc
--- a/examples/tcp-large-transfer.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/examples/tcp-large-transfer.cc	Tue Jul 01 16:43:12 2008 -0400
@@ -47,15 +47,18 @@ NS_LOG_COMPONENT_DEFINE ("TcpLargeTransf
 NS_LOG_COMPONENT_DEFINE ("TcpLargeTransfer");
 
 // The number of bytes to send in this simulation.
-static uint32_t txBytes = 2000000;
+static uint32_t txBytes1 = 536;
+static uint32_t txBytes2 = 536;
 
 // These are for starting the writing process, and handling the sending 
 // socket's notification upcalls (events).  These two together more or less
 // implement a sending "Application", although not a proper ns3::Application
 // subclass.
 
-void StartFlow(Ptr<Socket>, Ipv4Address, uint16_t);
-void WriteUntilBufferFull (Ptr<Socket>, uint32_t);
+void StartFlow1(Ptr<Socket>, Ipv4Address, uint16_t);
+void StartFlow2(Ptr<Socket>, Ipv4Address, uint16_t);
+void WriteUntilBufferFull1 (Ptr<Socket>, uint32_t);
+void WriteUntilBufferFull2 (Ptr<Socket>, uint32_t);
 
 int main (int argc, char *argv[])
 {
@@ -63,7 +66,7 @@ int main (int argc, char *argv[])
   // Users may find it convenient to turn on explicit debugging
   // for selected modules; the below lines suggest how to do this
   //  LogComponentEnable("TcpL4Protocol", LOG_LEVEL_ALL);
-  //  LogComponentEnable("TcpSocketImpl", LOG_LEVEL_ALL);
+  LogComponentEnable("TcpSocketImpl", LOG_LEVEL_ALL);
   //  LogComponentEnable("PacketSink", LOG_LEVEL_ALL);
   //  LogComponentEnable("TcpLargeTransfer", LOG_LEVEL_ALL);
 
@@ -138,15 +141,20 @@ int main (int argc, char *argv[])
   // will use sockets directly and register some socket callbacks as a sending
   // "Application".
 
-  // Create and bind the socket...
-  Ptr<Socket> localSocket =
+  // Create and bind two sockets...
+  Ptr<Socket> localSocket1 =
       Socket::CreateSocket (n0n1.Get (0), TcpSocketFactory::GetTypeId ());
-  localSocket->Bind ();
+  Ptr<Socket> localSocket2 =
+      Socket::CreateSocket (n0n1.Get (0), TcpSocketFactory::GetTypeId ());
+  localSocket1->Bind ();
+  localSocket2->Bind ();
 
   // ...and schedule the sending "Application"; This is similar to what an 
   // ns3::Application subclass would do internally.
-  Simulator::ScheduleNow (&StartFlow, localSocket,
+  Simulator::ScheduleNow (&StartFlow1, localSocket1,
                           ipInterfs.GetAddress (1), servPort);
+  Simulator::ScheduleNow (&StartFlow2, localSocket2,
+                           ipInterfs.GetAddress (1), servPort);
 
   // One can toggle the comment for the following line on or off to see the
   // effects of finite send buffer modelling.  One can also change the size of
@@ -173,7 +181,7 @@ int main (int argc, char *argv[])
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //begin implementation of sending "Application"
-void StartFlow(Ptr<Socket> localSocket,
+void StartFlow1(Ptr<Socket> localSocket,
                Ipv4Address servAddress,
                uint16_t servPort)
 {
@@ -182,19 +190,19 @@ void StartFlow(Ptr<Socket> localSocket,
 
   // tell the tcp implementation to call WriteUntilBufferFull again
   // if we blocked and new tx buffer space becomes available
-  localSocket->SetSendCallback (MakeCallback (&WriteUntilBufferFull));
-  WriteUntilBufferFull (localSocket, txBytes);
-}
-
-void WriteUntilBufferFull (Ptr<Socket> localSocket, uint32_t txSpace)
+  localSocket->SetSendCallback (MakeCallback (&WriteUntilBufferFull1));
+  WriteUntilBufferFull1 (localSocket, txBytes1);
+}
+
+void WriteUntilBufferFull1 (Ptr<Socket> localSocket, uint32_t txSpace)
 {
   // Perform series of 1040 byte writes (this is a multiple of 26 since
   // we want to detect data splicing in the output stream)
   uint32_t writeSize = 1040;
   uint8_t data[writeSize];
 
-  while (txBytes > 0) {
-    uint32_t curSize= txBytes > writeSize ? writeSize : txBytes;
+  while (txBytes1 > 0) {
+    uint32_t curSize= txBytes1 > writeSize ? writeSize : txBytes1;
     if (curSize > txSpace)
       curSize = txSpace;
     for(uint32_t i = 0; i < curSize; ++i)
@@ -206,10 +214,10 @@ void WriteUntilBufferFull (Ptr<Socket> l
     if(amountSent < 0)
       {
         // we will be called again when new tx space becomes available.
-        std::cout << "Socket blocking, " << txBytes << " left to write, returning" << std::endl;
+        std::cout << "Socket blocking, " << txBytes1 << " left to write, returning" << std::endl;
         return;
       }
-    txBytes -= curSize;
+    txBytes1 -= curSize;
     if (amountSent != (int)curSize)
       {
         std::cout << "Short Write, returning" << std::endl;
@@ -218,3 +226,49 @@ void WriteUntilBufferFull (Ptr<Socket> l
   }
   localSocket->Close ();
 }
+
+void StartFlow2(Ptr<Socket> localSocket,
+                Ipv4Address servAddress,
+                uint16_t servPort)
+{
+  NS_LOG_LOGIC("Starting flow at time " <<  Simulator::Now ().GetSeconds ());
+  localSocket->Connect (InetSocketAddress (servAddress, servPort));//connect
+
+  // tell the tcp implementation to call WriteUntilBufferFull again
+  // if we blocked and new tx buffer space becomes available
+  localSocket->SetSendCallback (MakeCallback (&WriteUntilBufferFull2));
+  WriteUntilBufferFull2 (localSocket, txBytes2);
+}
+
+void WriteUntilBufferFull2 (Ptr<Socket> localSocket, uint32_t txSpace)
+{
+  // Perform series of 1040 byte writes (this is a multiple of 26 since
+  // we want to detect data splicing in the output stream)
+  uint32_t writeSize = 1040;
+  uint8_t data[writeSize];
+
+  while (txBytes2 > 0) {
+    uint32_t curSize= txBytes2 > writeSize ? writeSize : txBytes2;
+    if (curSize > txSpace)
+      curSize = txSpace;
+    for(uint32_t i = 0; i < curSize; ++i)
+    {
+      char m = toascii (97 + i % 26);
+      data[i] = m;
+    }
+    int amountSent = localSocket->Send (data, curSize, 0);
+    if(amountSent < 0)
+    {
+        // we will be called again when new tx space becomes available.
+      std::cout << "Socket blocking, " << txBytes2 << " left to write, returning" << std::endl;
+      return;
+    }
+    txBytes2 -= curSize;
+    if (amountSent != (int)curSize)
+    {
+      std::cout << "Short Write, returning" << std::endl;
+      return;
+    }
+  }
+  localSocket->Close ();
+}
