[bug 810] Tcp GetSockName() for unconnected sockets
This commit is contained in:
@@ -630,8 +630,17 @@ int
|
||||
TcpSocketImpl::GetSockName (Address &address) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
address = InetSocketAddress(m_endPoint->GetLocalAddress (),
|
||||
m_endPoint->GetLocalPort ());
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
address = InetSocketAddress (m_endPoint->GetLocalAddress (),
|
||||
m_endPoint->GetLocalPort ());
|
||||
}
|
||||
else
|
||||
{
|
||||
// It is possible to call this method on a socket without a name
|
||||
// in which case, behavior is unspecified
|
||||
address = InetSocketAddress (Ipv4Address::GetZero (), 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -531,6 +531,8 @@ UdpSocketImpl::GetSockName (Address &address) const
|
||||
}
|
||||
else
|
||||
{
|
||||
// It is possible to call this method on a socket without a name
|
||||
// in which case, behavior is unspecified
|
||||
address = InetSocketAddress(Ipv4Address::GetZero(), 0);
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user