src/applications/model/udp-echo-server.cc
changeset 7820 9ebf12703683
parent 7807 21c50515e50a
child 9133 bcf7cef191c1
equal deleted inserted replaced
7819:30638cb5fd62 7820:9ebf12703683
   145   Address from;
   145   Address from;
   146   while ((packet = socket->RecvFrom (from)))
   146   while ((packet = socket->RecvFrom (from)))
   147     {
   147     {
   148       if (InetSocketAddress::IsMatchingType (from))
   148       if (InetSocketAddress::IsMatchingType (from))
   149         {
   149         {
   150           NS_LOG_INFO ("Server received " << packet->GetSize () << " bytes from " <<
   150           NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s server received " << packet->GetSize () << " bytes from " <<
   151                        InetSocketAddress::ConvertFrom (from).GetIpv4 () << " port " <<
   151                        InetSocketAddress::ConvertFrom (from).GetIpv4 () << " port " <<
   152                        InetSocketAddress::ConvertFrom (from).GetPort ());
   152                        InetSocketAddress::ConvertFrom (from).GetPort ());
   153         }
   153         }
   154       else if (Inet6SocketAddress::IsMatchingType (from))
   154       else if (Inet6SocketAddress::IsMatchingType (from))
   155         {
   155         {
   156           NS_LOG_INFO ("Server received " << packet->GetSize () << " bytes from " <<
   156           NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s server received " << packet->GetSize () << " bytes from " <<
   157                        Inet6SocketAddress::ConvertFrom (from).GetIpv6 () << " port " <<
   157                        Inet6SocketAddress::ConvertFrom (from).GetIpv6 () << " port " <<
   158                        InetSocketAddress::ConvertFrom (from).GetPort ());
   158                        InetSocketAddress::ConvertFrom (from).GetPort ());
   159         }
   159         }
   160 
   160 
   161       packet->RemoveAllPacketTags ();
   161       packet->RemoveAllPacketTags ();
   164       NS_LOG_LOGIC ("Echoing packet");
   164       NS_LOG_LOGIC ("Echoing packet");
   165       socket->SendTo (packet, 0, from);
   165       socket->SendTo (packet, 0, from);
   166 
   166 
   167       if (InetSocketAddress::IsMatchingType (from))
   167       if (InetSocketAddress::IsMatchingType (from))
   168         {
   168         {
   169           NS_LOG_INFO ("Server sent " << packet->GetSize () << " bytes to " <<
   169           NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s server sent " << packet->GetSize () << " bytes to " <<
   170                        InetSocketAddress::ConvertFrom (from).GetIpv4 () << " port " <<
   170                        InetSocketAddress::ConvertFrom (from).GetIpv4 () << " port " <<
   171                        InetSocketAddress::ConvertFrom (from).GetPort ());
   171                        InetSocketAddress::ConvertFrom (from).GetPort ());
   172         }
   172         }
   173       else if (Inet6SocketAddress::IsMatchingType (from))
   173       else if (Inet6SocketAddress::IsMatchingType (from))
   174         {
   174         {
   175           NS_LOG_INFO ("Server sent " << packet->GetSize () << " bytes to " <<
   175           NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s server sent " << packet->GetSize () << " bytes to " <<
   176                        Inet6SocketAddress::ConvertFrom (from).GetIpv6 () << " port " <<
   176                        Inet6SocketAddress::ConvertFrom (from).GetIpv6 () << " port " <<
   177                        InetSocketAddress::ConvertFrom (from).GetPort ());
   177                        InetSocketAddress::ConvertFrom (from).GetPort ());
   178         }
   178         }
   179     }
   179     }
   180 }
   180 }