applications: Extend logging for some applications
This commit is contained in:
@@ -139,14 +139,21 @@ PacketSink::StartApplication() // Called at time specified by Start
|
||||
if (local.IsInvalid())
|
||||
{
|
||||
local = InetSocketAddress(Ipv4Address::GetAny(), m_port);
|
||||
NS_LOG_INFO(this << " Binding on port " << m_port << " / " << local << ".");
|
||||
}
|
||||
else if (InetSocketAddress::IsMatchingType(local))
|
||||
{
|
||||
m_port = InetSocketAddress::ConvertFrom(local).GetPort();
|
||||
const auto ipv4 = InetSocketAddress::ConvertFrom(local).GetIpv4();
|
||||
NS_LOG_INFO(this << " Binding on " << ipv4 << " port " << m_port << " / " << local
|
||||
<< ".");
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType(local))
|
||||
{
|
||||
m_port = Inet6SocketAddress::ConvertFrom(local).GetPort();
|
||||
const auto ipv6 = Inet6SocketAddress::ConvertFrom(local).GetIpv6();
|
||||
NS_LOG_INFO(this << " Binding on " << ipv6 << " port " << m_port << " / " << local
|
||||
<< ".");
|
||||
}
|
||||
if (m_socket->Bind(local) == -1)
|
||||
{
|
||||
|
||||
@@ -236,11 +236,14 @@ UdpClient::StartApplication()
|
||||
std::stringstream peerAddressStringStream;
|
||||
if (InetSocketAddress::IsMatchingType(m_peer))
|
||||
{
|
||||
peerAddressStringStream << InetSocketAddress::ConvertFrom(m_peer).GetIpv4();
|
||||
peerAddressStringStream << InetSocketAddress::ConvertFrom(m_peer).GetIpv4() << ":"
|
||||
<< InetSocketAddress::ConvertFrom(m_peer).GetPort();
|
||||
;
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType(m_peer))
|
||||
{
|
||||
peerAddressStringStream << Inet6SocketAddress::ConvertFrom(m_peer).GetIpv6();
|
||||
peerAddressStringStream << Inet6SocketAddress::ConvertFrom(m_peer).GetIpv6() << ":"
|
||||
<< Inet6SocketAddress::ConvertFrom(m_peer).GetPort();
|
||||
}
|
||||
m_peerString = peerAddressStringStream.str();
|
||||
#endif // NS3_LOG_ENABLE
|
||||
|
||||
@@ -128,6 +128,22 @@ UdpServer::StartApplication()
|
||||
if (local.IsInvalid())
|
||||
{
|
||||
local = InetSocketAddress(Ipv4Address::GetAny(), m_port);
|
||||
NS_LOG_INFO(this << " Binding on port " << m_port << " / " << local << ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (InetSocketAddress::IsMatchingType(m_local))
|
||||
{
|
||||
const auto ipv4 = InetSocketAddress::ConvertFrom(m_local).GetIpv4();
|
||||
NS_LOG_INFO(this << " Binding on " << ipv4 << " port " << m_port << " / " << m_local
|
||||
<< ".");
|
||||
}
|
||||
else if (Ipv6Address::IsMatchingType(m_local))
|
||||
{
|
||||
const auto ipv6 = Inet6SocketAddress::ConvertFrom(m_local).GetIpv6();
|
||||
NS_LOG_INFO(this << " Binding on " << ipv6 << " port " << m_port << " / " << m_local
|
||||
<< ".");
|
||||
}
|
||||
}
|
||||
if (m_socket->Bind(local) == -1)
|
||||
{
|
||||
|
||||
@@ -375,15 +375,19 @@ UdpTraceClient::SendPacket(uint32_t size)
|
||||
seqTs.SetSeq(m_sent);
|
||||
p->AddHeader(seqTs);
|
||||
|
||||
std::stringstream addressString;
|
||||
std::stringstream addressString{};
|
||||
#ifdef NS3_LOG_ENABLE
|
||||
if (InetSocketAddress::IsMatchingType(m_peer))
|
||||
{
|
||||
addressString << InetSocketAddress::ConvertFrom(m_peer).GetIpv4();
|
||||
addressString << InetSocketAddress::ConvertFrom(m_peer).GetIpv4() << ":"
|
||||
<< InetSocketAddress::ConvertFrom(m_peer).GetPort();
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType(m_peer))
|
||||
{
|
||||
addressString << Inet6SocketAddress::ConvertFrom(m_peer).GetIpv6();
|
||||
addressString << Inet6SocketAddress::ConvertFrom(m_peer).GetIpv6() << ":"
|
||||
<< Inet6SocketAddress::ConvertFrom(m_peer).GetPort();
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((m_socket->Send(p)) >= 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user