OLD | NEW |
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 2007 University of Washington | 3 * Copyright 2007 University of Washington |
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 void· | 141 void· |
142 UdpEchoServer::HandleRead (Ptr<Socket> socket) | 142 UdpEchoServer::HandleRead (Ptr<Socket> socket) |
143 { | 143 { |
144 Ptr<Packet> packet; | 144 Ptr<Packet> packet; |
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 serve
r received " << packet->GetSize () << " bytes from " << |
151 InetSocketAddress::ConvertFrom (from).GetIpv4 () << " por
t " << | 151 InetSocketAddress::ConvertFrom (from).GetIpv4 () << " por
t " << |
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 serve
r received " << packet->GetSize () << " bytes from " << |
157 Inet6SocketAddress::ConvertFrom (from).GetIpv6 () << " po
rt " << | 157 Inet6SocketAddress::ConvertFrom (from).GetIpv6 () << " po
rt " << |
158 InetSocketAddress::ConvertFrom (from).GetPort ()); | 158 InetSocketAddress::ConvertFrom (from).GetPort ()); |
159 } | 159 } |
160 | 160 |
161 packet->RemoveAllPacketTags (); | 161 packet->RemoveAllPacketTags (); |
162 packet->RemoveAllByteTags (); | 162 packet->RemoveAllByteTags (); |
163 | 163 |
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 serve
r sent " << packet->GetSize () << " bytes to " << |
170 InetSocketAddress::ConvertFrom (from).GetIpv4 () << " por
t " << | 170 InetSocketAddress::ConvertFrom (from).GetIpv4 () << " por
t " << |
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 serve
r sent " << packet->GetSize () << " bytes to " << |
176 Inet6SocketAddress::ConvertFrom (from).GetIpv6 () << " po
rt " << | 176 Inet6SocketAddress::ConvertFrom (from).GetIpv6 () << " po
rt " << |
177 InetSocketAddress::ConvertFrom (from).GetPort ()); | 177 InetSocketAddress::ConvertFrom (from).GetPort ()); |
178 } | 178 } |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 } // Namespace ns3 | 182 } // Namespace ns3 |
OLD | NEW |