diff options
Diffstat (limited to 'unix/tclUnixSock.c')
-rw-r--r-- | unix/tclUnixSock.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 49a6460..c866903 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -163,6 +163,18 @@ static TclInitProcessGlobalValueProc InitializeHostName; static ProcessGlobalValue hostName = {0, 0, NULL, NULL, InitializeHostName, NULL, NULL}; +void printaddrinfo(struct addrinfo *addrlist, char *prefix) +{ + char host[NI_MAXHOST], port[NI_MAXSERV]; + struct addrinfo *ai; + for (ai = addrlist; ai != NULL; ai = ai->ai_next) { + getnameinfo(ai->ai_addr, ai->ai_addrlen, + host, sizeof(host), + port, sizeof(port), + NI_NUMERICHOST|NI_NUMERICSERV); + fprintf(stderr,"%s: %s:%s\n", prefix, host, port); + } +} /* *---------------------------------------------------------------------- * @@ -1160,6 +1172,9 @@ Tcl_OpenTcpClient( return NULL; } + printaddrinfo(myaddrlist, "local"); + printaddrinfo(addrlist, "remote"); + /* * Allocate a new TcpState for this socket. */ |