--- a/src/internet/model/tcp-socket-base.cc Tue Aug 16 21:44:36 2011 -0700
+++ b/src/internet/model/tcp-socket-base.cc Wed Aug 17 11:39:16 2011 -0400
@@ -242,6 +242,11 @@
else if (ipv4 == Ipv4Address::GetAny () && port != 0)
{
m_endPoint = m_tcp->Allocate (port);
+ if (0 == m_endPoint)
+ {
+ m_errno = ERROR_ADDRINUSE;
+ return -1;
+ }
}
else if (ipv4 != Ipv4Address::GetAny () && port == 0)
{
@@ -250,6 +255,11 @@
else if (ipv4 != Ipv4Address::GetAny () && port != 0)
{
m_endPoint = m_tcp->Allocate (ipv4, port);
+ if (0 == m_endPoint)
+ {
+ m_errno = ERROR_ADDRINUSE;
+ return -1;
+ }
}
NS_LOG_LOGIC ("TcpSocketBase " << this << " got an endpoint: " << m_endPoint);
--- a/src/network/model/socket.h Tue Aug 16 21:44:36 2011 -0700
+++ b/src/network/model/socket.h Wed Aug 17 11:39:16 2011 -0400
@@ -82,6 +82,7 @@
ERROR_NOROUTETOHOST,
ERROR_NODEV,
ERROR_ADDRNOTAVAIL,
+ ERROR_ADDRINUSE,
SOCKET_ERRNO_LAST
};