summaryrefslogtreecommitdiff
path: root/ace/INET_Addr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ace/INET_Addr.cpp')
-rw-r--r--ace/INET_Addr.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp
index a80a2fd06a9..ac100d46117 100644
--- a/ace/INET_Addr.cpp
+++ b/ace/INET_Addr.cpp
@@ -40,6 +40,9 @@ ACE_INET_Addr::addr_to_string (ACE_TCHAR s[],
ACE_OS::strlen (this->get_host_addr ()))
+ ACE_OS::strlen ("65536") // Assume the max port number.
+ sizeof (':')
+#if defined ACE_HAS_IPV6
+ + ACE_OS::strlen ("[]")
+#endif
+ sizeof ('\0'); // For trailing '\0'.
if (size < total_len)
@@ -47,7 +50,11 @@ ACE_INET_Addr::addr_to_string (ACE_TCHAR s[],
else
{
ACE_OS::sprintf (s,
+#if defined ACE_HAS_IPV6
+ ACE_LIB_TEXT ("[%s]:%d"),
+#else
ACE_LIB_TEXT ("%s:%d"),
+#endif
ACE_TEXT_CHAR_TO_TCHAR (ipaddr_format == 0
? this->get_host_name ()
: this->get_host_addr ()),