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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 packetSize = size - 12; // 12 is the size of the SeqTsHeader | 273 packetSize = size - 12; // 12 is the size of the SeqTsHeader |
274 } | 274 } |
275 else | 275 else |
276 { | 276 { |
277 packetSize = 0; | 277 packetSize = 0; |
278 } | 278 } |
279 p = Create<Packet> (packetSize); | 279 p = Create<Packet> (packetSize); |
280 SeqTsHeader seqTs; | 280 SeqTsHeader seqTs; |
281 seqTs.SetSeq (m_sent); | 281 seqTs.SetSeq (m_sent); |
282 p->AddHeader (seqTs); | 282 p->AddHeader (seqTs); |
| 283 |
| 284 std::stringstream addressString; |
| 285 if (Ipv4Address::IsMatchingType(m_peerAddress) == true) |
| 286 { |
| 287 addressString << Ipv4Address::ConvertFrom (m_peerAddress); |
| 288 } |
| 289 else if (Ipv6Address::IsMatchingType(m_peerAddress) == true) |
| 290 { |
| 291 addressString << Ipv6Address::ConvertFrom (m_peerAddress); |
| 292 } |
| 293 else |
| 294 { |
| 295 addressString << m_peerAddress; |
| 296 } |
| 297 |
283 if ((m_socket->Send (p)) >= 0) | 298 if ((m_socket->Send (p)) >= 0) |
284 { | 299 { |
285 ++m_sent; | 300 ++m_sent; |
286 NS_LOG_INFO ("Sent " << size << " bytes to " | 301 NS_LOG_INFO ("Sent " << size << " bytes to " |
287 << m_peerAddress); | 302 << addressString.str ()); |
288 } | 303 } |
289 else | 304 else |
290 { | 305 { |
291 NS_LOG_INFO ("Error while sending " << size << " bytes to " | 306 NS_LOG_INFO ("Error while sending " << size << " bytes to " |
292 << m_peerAddress); | 307 << addressString.str ()); |
293 } | 308 } |
294 } | 309 } |
295 | 310 |
296 void | 311 void |
297 UdpTraceClient::Send (void) | 312 UdpTraceClient::Send (void) |
298 { | 313 { |
299 NS_LOG_FUNCTION (this); | 314 NS_LOG_FUNCTION (this); |
300 | 315 |
301 NS_ASSERT (m_sendEvent.IsExpired ()); | 316 NS_ASSERT (m_sendEvent.IsExpired ()); |
302 Ptr<Packet> p; | 317 Ptr<Packet> p; |
(...skipping 10 matching lines...) Expand all Loading... |
313 | 328 |
314 m_currentEntry++; | 329 m_currentEntry++; |
315 m_currentEntry %= m_entries.size (); | 330 m_currentEntry %= m_entries.size (); |
316 entry = &m_entries[m_currentEntry]; | 331 entry = &m_entries[m_currentEntry]; |
317 } | 332 } |
318 while (entry->timeToSend == 0); | 333 while (entry->timeToSend == 0); |
319 m_sendEvent = Simulator::Schedule (MilliSeconds (entry->timeToSend), &UdpTrace
Client::Send, this); | 334 m_sendEvent = Simulator::Schedule (MilliSeconds (entry->timeToSend), &UdpTrace
Client::Send, this); |
320 } | 335 } |
321 | 336 |
322 } // Namespace ns3 | 337 } // Namespace ns3 |
LEFT | RIGHT |