LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2007,2008,2009 INRIA, UDCAST | 3 * Copyright (c) 2007,2008,2009 INRIA, UDCAST |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 void | 148 void |
149 UdpClient::Send (void) | 149 UdpClient::Send (void) |
150 { | 150 { |
151 NS_LOG_FUNCTION_NOARGS (); | 151 NS_LOG_FUNCTION_NOARGS (); |
152 NS_ASSERT (m_sendEvent.IsExpired ()); | 152 NS_ASSERT (m_sendEvent.IsExpired ()); |
153 SeqTsHeader seqTs; | 153 SeqTsHeader seqTs; |
154 seqTs.SetSeq (m_sent); | 154 seqTs.SetSeq (m_sent); |
155 Ptr<Packet> p = Create<Packet> (m_size-(8+4)); // 8+4 : the size of the seqTs
header | 155 Ptr<Packet> p = Create<Packet> (m_size-(8+4)); // 8+4 : the size of the seqTs
header |
156 p->AddHeader (seqTs); | 156 p->AddHeader (seqTs); |
157 | 157 |
| 158 std::stringstream peerAddressStringStream; |
| 159 if (Ipv4Address::IsMatchingType (m_peerAddress)) |
| 160 { |
| 161 peerAddressStringStream << Ipv4Address::ConvertFrom (m_peerAddress); |
| 162 } |
| 163 else if (Ipv6Address::IsMatchingType (m_peerAddress)) |
| 164 { |
| 165 peerAddressStringStream << Ipv6Address::ConvertFrom (m_peerAddress); |
| 166 } |
| 167 |
158 if ((m_socket->Send (p)) >= 0) | 168 if ((m_socket->Send (p)) >= 0) |
159 { | 169 { |
160 ++m_sent; | 170 ++m_sent; |
161 NS_LOG_INFO ("TraceDelay TX " << m_size << " bytes to " | 171 NS_LOG_INFO ("TraceDelay TX " << m_size << " bytes to " |
162 << m_peerAddress << " Uid: " << p->GetUid () | 172 << peerAddressStringStream.str () << " Uid:
" |
163 << " Time: " << (Simulator::Now ()).GetSecon
ds ()); | 173 << p->GetUid () << " Time: " |
| 174 << (Simulator::Now ()).GetSeconds ()); |
164 | 175 |
165 } | 176 } |
166 else | 177 else |
167 { | 178 { |
168 NS_LOG_INFO ("Error while sending " << m_size << " bytes to " | 179 NS_LOG_INFO ("Error while sending " << m_size << " bytes to " |
169 << m_peerAddress); | 180 << peerAddressStringStream.str ()); |
170 } | 181 } |
171 | 182 |
172 if (m_sent < m_count) | 183 if (m_sent < m_count) |
173 { | 184 { |
174 m_sendEvent = Simulator::Schedule (m_interval, &UdpClient::Send, this); | 185 m_sendEvent = Simulator::Schedule (m_interval, &UdpClient::Send, this); |
175 } | 186 } |
176 } | 187 } |
177 | 188 |
178 } // Namespace ns3 | 189 } // Namespace ns3 |
LEFT | RIGHT |