View | Details | Raw Unified | Return to bug 244
Collapse All | Expand All

(-)a/examples/tcp-large-transfer.cc (+1 lines)
 Lines 132-137   int main (int argc, char *argv[]) Link Here 
132
132
133
  ApplicationContainer apps = sink.Install (n1n2.Get (1));
133
  ApplicationContainer apps = sink.Install (n1n2.Get (1));
134
  apps.Start (Seconds (0.0));
134
  apps.Start (Seconds (0.0));
135
  apps.Stop (Seconds (60.0));
135
136
136
  // Create a source to send packets from n0.  Instead of a full Application
137
  // Create a source to send packets from n0.  Instead of a full Application
137
  // and the helper APIs you might see in other example files, this example
138
  // and the helper APIs you might see in other example files, this example
(-)a/src/applications/packet-sink/packet-sink.cc (-1 / +12 lines)
 Lines 88-98   void PacketSink::StartApplication() / Link Here 
88
  m_socket->SetRecvCallback (MakeCallback(&PacketSink::HandleRead, this));
88
  m_socket->SetRecvCallback (MakeCallback(&PacketSink::HandleRead, this));
89
  m_socket->SetAcceptCallback (
89
  m_socket->SetAcceptCallback (
90
            MakeNullCallback<bool, Ptr<Socket>, const Address &> (),
90
            MakeNullCallback<bool, Ptr<Socket>, const Address &> (),
91
            MakeNullCallback<void, Ptr<Socket>, const Address&> ());
91
            MakeCallback(&PacketSink::HandleAccept, this));
92
}
92
}
93
93
94
void PacketSink::StopApplication()     // Called at time specified by Stop
94
void PacketSink::StopApplication()     // Called at time specified by Stop
95
{
95
{
96
  while(!m_socketList.empty()) //these are accepted sockets, close them
97
  {
98
    Ptr<Socket> acceptedSocket = m_socketList.front();
99
    m_socketList.pop_front();
100
    acceptedSocket->Close();
101
  }
96
  if (m_socket) 
102
  if (m_socket) 
97
    {
103
    {
98
      m_socket->SetRecvCallback (MakeNullCallback<void, Ptr<Socket> > ());
104
      m_socket->SetRecvCallback (MakeNullCallback<void, Ptr<Socket> > ());
 Lines 116-119   void PacketSink::HandleRead (Ptr<Socket> Link Here 
116
    }
122
    }
117
}
123
}
118
124
125
void PacketSink::HandleAccept (Ptr<Socket> s, const Address& from)
126
{
127
  m_socketList.push_back(s);
128
}
129
119
} // Namespace ns3
130
} // Namespace ns3
(-)a/src/applications/packet-sink/packet-sink.h (+2 lines)
 Lines 81-88   private: Link Here 
81
  virtual void StopApplication (void);     // Called at time specified by Stop
81
  virtual void StopApplication (void);     // Called at time specified by Stop
82
82
83
  void HandleRead (Ptr<Socket> socket);
83
  void HandleRead (Ptr<Socket> socket);
84
  void HandleAccept (Ptr<Socket>, const Address& from);
84
85
85
  Ptr<Socket>     m_socket;       // Associated socket
86
  Ptr<Socket>     m_socket;       // Associated socket
87
  std::list<Ptr<Socket> > m_socketList; //the accepted sockets
86
  Address         m_local;        // Local address to bind to
88
  Address         m_local;        // Local address to bind to
87
  TypeId          m_tid;          // Protocol TypeId
89
  TypeId          m_tid;          // Protocol TypeId
88
  TracedCallback<Ptr<const Packet>, const Address &> m_rxTrace;
90
  TracedCallback<Ptr<const Packet>, const Address &> m_rxTrace;

Return to bug 244