Index: pjproject/trunk/pjlib-util/src/pjlib-util/cli_telnet.c
===================================================================
--- pjproject/trunk/pjlib-util/src/pjlib-util/cli_telnet.c	(revision 5310)
+++ pjproject/trunk/pjlib-util/src/pjlib-util/cli_telnet.c	(revision 5311)
@@ -1929,5 +1929,6 @@
 	return status;
 
-    pj_strcpy2(&info->ip_address, pj_inet_ntoa(hostip.ipv4.sin_addr));
+    pj_sockaddr_print(&hostip, info->buf_, sizeof(info->buf_), 0);
+    pj_strset2(&info->ip_address, info->buf_);
 
     info->port = tfe->cfg.port;
Index: pjproject/trunk/pjlib-util/src/pjlib-util/dns_dump.c
===================================================================
--- pjproject/trunk/pjlib-util/src/pjlib-util/dns_dump.c	(revision 5310)
+++ pjproject/trunk/pjlib-util/src/pjlib-util/dns_dump.c	(revision 5311)
@@ -91,4 +91,5 @@
     const pj_str_t *name = &rr->name;
     char ttl_words[32];
+    char addr[PJ_INET6_ADDRSTRLEN];
 
     if (name->slen == 0)
@@ -118,7 +119,7 @@
     } else if (rr->type == PJ_DNS_TYPE_A) {
 	PJ_LOG(3,(THIS_FILE, "    IP address: %s",
-		  pj_inet_ntoa(rr->rdata.a.ip_addr)));
+		  pj_inet_ntop2(pj_AF_INET(), &rr->rdata.a.ip_addr,
+		  		addr, sizeof(addr))));
     } else if (rr->type == PJ_DNS_TYPE_AAAA) {
-	char addr[PJ_INET6_ADDRSTRLEN];
 	PJ_LOG(3,(THIS_FILE, "    IPv6 address: %s",
 		  pj_inet_ntop2(pj_AF_INET6(), &rr->rdata.aaaa.ip_addr,
Index: pjproject/trunk/pjlib-util/src/pjlib-util/pcap.c
===================================================================
--- pjproject/trunk/pjlib-util/src/pjlib-util/pcap.c	(revision 5310)
+++ pjproject/trunk/pjlib-util/src/pjlib-util/pcap.c	(revision 5311)
@@ -230,7 +230,9 @@
 	pj_ssize_t sz;
 	pj_size_t sz_read = 0;
+	char addr[PJ_INET_ADDRSTRLEN];
 	pj_status_t status;
 
 	TRACE_((file->obj_name, "Reading packet.."));
+	pj_bzero(&addr, sizeof(addr));
 
 	/* Read PCAP packet header */
@@ -283,5 +285,6 @@
 	if (file->filter.ip_src && tmp.ip.ip_src != file->filter.ip_src) {
 	    TRACE_((file->obj_name, "IP source %s mismatch, skipping", 
-		    pj_inet_ntoa(*(pj_in_addr*)&tmp.ip.ip_src)));
+		    pj_inet_ntop2(pj_AF_INET(), (pj_in_addr*)&tmp.ip.ip_src,
+		    		  addr, sizeof(addr))));
 	    SKIP_PKT();
 	    continue;
@@ -291,5 +294,6 @@
 	if (file->filter.ip_dst && tmp.ip.ip_dst != file->filter.ip_dst) {
 	    TRACE_((file->obj_name, "IP detination %s mismatch, skipping", 
-		    pj_inet_ntoa(*(pj_in_addr*)&tmp.ip.ip_dst)));
+		    pj_inet_ntop2(pj_AF_INET(), (pj_in_addr*)&tmp.ip.ip_dst,
+		    		  addr, sizeof(addr))));
 	    SKIP_PKT();
 	    continue;
Index: pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c
===================================================================
--- pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c	(revision 5310)
+++ pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c	(revision 5311)
@@ -639,4 +639,5 @@
     /* Send the packet to name servers */
     for (i=0; i<server_cnt; ++i) {
+        char addr[PJ_INET6_ADDRSTRLEN];
 	pj_ssize_t sent  = (pj_ssize_t) pkt_size;
 	struct nameserver *ns = &resolver->ns[servers[i]];
@@ -652,5 +653,6 @@
 		  (q->transmit_cnt==0? "Transmitting":"Re-transmitting"),
 		  (int)pkt_size, servers[i],
-		  pj_inet_ntoa(ns->addr.sin_addr), 
+		  pj_inet_ntop2(pj_AF_INET(), &ns->addr.sin_addr, addr,
+		 		sizeof(addr)),
 		  (int)pj_ntohs(ns->addr.sin_port),
 		  pj_dns_get_type_name(q->key.qtype), 
@@ -1035,4 +1037,5 @@
     struct nameserver *ns = &resolver->ns[index];
     enum ns_state old_state = ns->state;
+    char addr[PJ_INET_ADDRSTRLEN];
 
     ns->state = state;
@@ -1048,5 +1051,6 @@
 
     PJ_LOG(5, (resolver->name.ptr, "Nameserver %s:%d state changed %s --> %s",
-	       pj_inet_ntoa(ns->addr.sin_addr),
+    	       pj_inet_ntop2(pj_AF_INET(), &ns->addr.sin_addr, addr,
+		 	     sizeof(addr)),
 	       (int)pj_ntohs(ns->addr.sin_port),
 	       state_names[old_state], state_names[state]));
@@ -1391,4 +1395,5 @@
     pj_dns_parsed_packet *dns_pkt;
     pj_dns_async_query *q;
+    char addr[PJ_INET_ADDRSTRLEN];
     pj_status_t status;
     PJ_USE_EXCEPTION;
@@ -1407,5 +1412,6 @@
 	PJ_LOG(4,(resolver->name.ptr, 
 		  "DNS resolver read error from %s:%d: %s", 
-		  pj_inet_ntoa(resolver->udp_src_addr.sin_addr),
+		  pj_inet_ntop2(pj_AF_INET(), &resolver->udp_src_addr.sin_addr,
+		  		addr, sizeof(addr)), 
 		  pj_ntohs(resolver->udp_src_addr.sin_port),
 		  errmsg));
@@ -1417,5 +1423,6 @@
 	      "Received %d bytes DNS response from %s:%d",
 	      (int)bytes_read, 
-	      pj_inet_ntoa(resolver->udp_src_addr.sin_addr),
+	      pj_inet_ntop2(pj_AF_INET(), &resolver->udp_src_addr.sin_addr,
+		  	    addr, sizeof(addr)), 
 	      pj_ntohs(resolver->udp_src_addr.sin_port)));
 
@@ -1451,5 +1458,6 @@
 	PJ_LOG(3,(resolver->name.ptr, 
 		  "Error parsing DNS response from %s:%d: %s", 
-		  pj_inet_ntoa(resolver->udp_src_addr.sin_addr), 
+		  pj_inet_ntop2(pj_AF_INET(), &resolver->udp_src_addr.sin_addr,
+		  		addr, sizeof(addr)),
 		  pj_ntohs(resolver->udp_src_addr.sin_port), 
 		  errmsg));
@@ -1464,5 +1472,6 @@
 	PJ_LOG(5,(resolver->name.ptr, 
 		  "DNS response from %s:%d id=%d discarded",
-		  pj_inet_ntoa(resolver->udp_src_addr.sin_addr), 
+		  pj_inet_ntop2(pj_AF_INET(), &resolver->udp_src_addr.sin_addr,
+		  		addr, sizeof(addr)), 
 		  pj_ntohs(resolver->udp_src_addr.sin_port),
 		  (unsigned)dns_pkt->hdr.id));
@@ -1634,9 +1643,11 @@
     PJ_LOG(3,(resolver->name.ptr, "  Name servers:"));
     for (i=0; i<resolver->ns_count; ++i) {
+	char addr[PJ_INET_ADDRSTRLEN];
 	struct nameserver *ns = &resolver->ns[i];
 
 	PJ_LOG(3,(resolver->name.ptr,
 		  "   NS %d: %s:%d (state=%s until %ds, rtt=%d ms)",
-		  i, pj_inet_ntoa(ns->addr.sin_addr),
+		  i, pj_inet_ntop2(pj_AF_INET(), &ns->addr.sin_addr, addr,
+		 		   sizeof(addr)),
 		  pj_ntohs(ns->addr.sin_port),
 		  state_names[ns->state],
Index: pjproject/trunk/pjlib-util/src/pjlib-util/srv_resolver.c
===================================================================
--- pjproject/trunk/pjlib-util/src/pjlib-util/srv_resolver.c	(revision 5310)
+++ pjproject/trunk/pjlib-util/src/pjlib-util/srv_resolver.c	(revision 5311)
@@ -369,5 +369,7 @@
 	}
 
-	if (pj_inet_aton(&query_job->srv[i].target_name, &addr) != 0) {
+	if (pj_inet_pton(pj_AF_INET(), &query_job->srv[i].target_name,
+			 &addr) == PJ_SUCCESS)
+	{
 	    query_job->srv[i].addr[query_job->srv[i].addr_cnt++] = addr;
 	    ++query_job->host_resolved;
@@ -386,10 +388,11 @@
 
     for (i=0; i<query_job->srv_cnt; ++i) {
-	const char *addr;
-
-	if (query_job->srv[i].addr_cnt != 0)
-	    addr = pj_inet_ntoa(query_job->srv[i].addr[0]);
-	else
-	    addr = "-";
+	char addr[PJ_INET_ADDRSTRLEN];
+
+	if (query_job->srv[i].addr_cnt != 0) {
+	    pj_inet_ntop(pj_AF_INET(), &query_job->srv[i].addr[0],
+			 addr, sizeof(addr));
+	} else
+	    pj_ansi_strcpy(addr, "-");
 
 	PJ_LOG(5,(query_job->objname, 
@@ -548,4 +551,5 @@
 	/* Check that we really have answer */
 	if (status==PJ_SUCCESS && pkt->hdr.anscount != 0) {
+	    char addr[PJ_INET_ADDRSTRLEN];
 	    pj_dns_a_record rec;
 
@@ -574,5 +578,6 @@
 			  (int)srv->target_name.slen, 
 			  srv->target_name.ptr,
-			  pj_inet_ntoa(rec.addr[0])));
+			  pj_inet_ntop2(pj_AF_INET(), &rec.addr[0],
+			  		addr, sizeof(addr))));
 	    }
 
@@ -586,5 +591,6 @@
 			  (int)srv->target_name.slen, 
 			  srv->target_name.ptr,
-			  pj_inet_ntoa(rec.addr[i])));
+			  pj_inet_ntop2(pj_AF_INET(), &rec.addr[i],
+			  		addr, sizeof(addr))));
 	    }
 
Index: pjproject/trunk/pjlib-util/src/pjlib-util/stun_simple_client.c
===================================================================
--- pjproject/trunk/pjlib-util/src/pjlib-util/stun_simple_client.c	(revision 5310)
+++ pjproject/trunk/pjlib-util/src/pjlib-util/stun_simple_client.c	(revision 5311)
@@ -34,5 +34,4 @@
 
 #define THIS_FILE	"stun_client.c"
-#define LOG_ADDR(addr)	pj_inet_ntoa(addr.sin_addr), pj_ntohs(addr.sin_port)
 
 #define TRACE_(x)	PJ_LOG(6,x)
Index: pjproject/trunk/pjlib/src/pjlib-test/echo_clt.c
===================================================================
--- pjproject/trunk/pjlib/src/pjlib-test/echo_clt.c	(revision 5310)
+++ pjproject/trunk/pjlib/src/pjlib-test/echo_clt.c	(revision 5311)
@@ -58,4 +58,5 @@
     char send_buf[BUF_SIZE];
     char recv_buf[BUF_SIZE];
+    char addr[PJ_INET_ADDRSTRLEN];
     pj_sockaddr_in addr;
     pj_str_t s;
@@ -88,5 +89,6 @@
 
     PJ_LOG(3,("", "...socket connected to %s:%d", 
-		  pj_inet_ntoa(addr.sin_addr),
+		  pj_inet_ntop2(pj_AF_INET(), &addr.sin_addr,
+		  		addr, sizeof(addr)),
 		  pj_ntohs(addr.sin_port)));
 
Index: pjproject/trunk/pjmedia/src/pjmedia/endpoint.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/endpoint.c	(revision 5310)
+++ pjproject/trunk/pjmedia/src/pjmedia/endpoint.c	(revision 5311)
@@ -765,4 +765,5 @@
 						   pjmedia_sdp_session **p_sdp)
 {
+    char tmp_addr[PJ_INET6_ADDRSTRLEN];
     pj_time_val tv;
     pjmedia_sdp_session *sdp;
@@ -780,17 +781,13 @@
     if (origin->addr.sa_family == pj_AF_INET()) {
  	sdp->origin.addr_type = STR_IP4;
- 	pj_strdup2(pool, &sdp->origin.addr,
- 		   pj_inet_ntoa(origin->ipv4.sin_addr));
     } else if (origin->addr.sa_family == pj_AF_INET6()) {
- 	char tmp_addr[PJ_INET6_ADDRSTRLEN];
-
  	sdp->origin.addr_type = STR_IP6;
- 	pj_strdup2(pool, &sdp->origin.addr,
- 		   pj_sockaddr_print(origin, tmp_addr, sizeof(tmp_addr), 0));
-
     } else {
  	pj_assert(!"Invalid address family");
  	return PJ_EAFNOTSUP;
     }
+
+    pj_strdup2(pool, &sdp->origin.addr,
+ 	       pj_sockaddr_print(origin, tmp_addr, sizeof(tmp_addr), 0));
 
     if (sess_name)
Index: pjproject/trunk/pjmedia/src/pjmedia/sdp.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/sdp.c	(revision 5310)
+++ pjproject/trunk/pjmedia/src/pjmedia/sdp.c	(revision 5311)
@@ -432,4 +432,5 @@
 	ATTR_LEN = PJ_INET6_ADDRSTRLEN+16
     };
+    char tmp_addr[PJ_INET6_ADDRSTRLEN];
     pjmedia_sdp_attr *attr;
 
@@ -441,8 +442,8 @@
 	    pj_ansi_snprintf(attr->value.ptr, ATTR_LEN,
 			    "%u IN IP4 %s",
-			    pj_ntohs(a->ipv4.sin_port),
-			    pj_inet_ntoa(a->ipv4.sin_addr));
+			    pj_sockaddr_get_port(a),
+			    pj_sockaddr_print(a, tmp_addr, 
+					      sizeof(tmp_addr), 0));
     } else if (a->addr.sa_family == pj_AF_INET6()) {
-	char tmp_addr[PJ_INET6_ADDRSTRLEN];
 	attr->value.slen = 
 	    pj_ansi_snprintf(attr->value.ptr, ATTR_LEN,
Index: pjproject/trunk/pjnath/src/pjnath/nat_detect.c
===================================================================
--- pjproject/trunk/pjnath/src/pjnath/nat_detect.c	(revision 5310)
+++ pjproject/trunk/pjnath/src/pjnath/nat_detect.c	(revision 5311)
@@ -215,4 +215,5 @@
     pj_ioqueue_callback ioqueue_cb;
     int addr_len;
+    char addr[PJ_INET_ADDRSTRLEN];
     pj_status_t status;
 
@@ -287,9 +288,11 @@
 
     PJ_LOG(5,(sess->pool->obj_name, "Local address is %s:%d",
-	      pj_inet_ntoa(sess->local_addr.sin_addr), 
+	      pj_inet_ntop2(pj_AF_INET(), &sess->local_addr.sin_addr,
+	      		    addr, sizeof(addr)), 
 	      pj_ntohs(sess->local_addr.sin_port)));
 
     PJ_LOG(5,(sess->pool->obj_name, "Server set to %s:%d",
-	      pj_inet_ntoa(server->sin_addr), 
+	      pj_inet_ntop2(pj_AF_INET(), &server->sin_addr, addr,
+	      		    sizeof(addr)), 
 	      pj_ntohs(server->sin_port)));
 
@@ -815,4 +818,5 @@
 {
     pj_uint32_t magic, tsx_id[3];
+    char addr[PJ_INET_ADDRSTRLEN];
     pj_status_t status;
 
@@ -853,5 +857,6 @@
               "Performing %s to %s:%d", 
 	      test_names[test_id],
-	      pj_inet_ntoa(sess->cur_server->sin_addr),
+	      pj_inet_ntop2(pj_AF_INET(), &sess->cur_server->sin_addr,
+	      		    addr, sizeof(addr)),
 	      pj_ntohs(sess->cur_server->sin_port)));
 
Index: pjproject/trunk/pjnath/src/pjnath/stun_msg_dump.c
===================================================================
--- pjproject/trunk/pjnath/src/pjnath/stun_msg_dump.c	(revision 5310)
+++ pjproject/trunk/pjnath/src/pjnath/stun_msg_dump.c	(revision 5311)
@@ -87,4 +87,5 @@
     case PJ_STUN_ATTR_ALTERNATE_SERVER:
 	{
+	    char addr[PJ_INET6_ADDRSTRLEN];
 	    const pj_stun_sockaddr_attr *attr;
 
@@ -94,6 +95,7 @@
 		len = pj_ansi_snprintf(p, end-p,
 				       ", IPv4 addr=%s:%d\n",
-				       pj_inet_ntoa(attr->sockaddr.ipv4.sin_addr),
-				       pj_ntohs(attr->sockaddr.ipv4.sin_port));
+				       pj_sockaddr_print(&attr->sockaddr,
+				           		 addr, sizeof(addr),0),
+				       pj_sockaddr_get_port(&attr->sockaddr));
 
 	    } else if (attr->sockaddr.addr.sa_family == pj_AF_INET6()) {
Index: pjproject/trunk/pjsip-apps/src/samples/proxy.h
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/proxy.h	(revision 5310)
+++ pjproject/trunk/pjsip-apps/src/samples/proxy.h	(revision 5311)
@@ -253,6 +253,8 @@
      */
     if (pj_gethostip(pj_AF_INET(), &pri_addr)==PJ_SUCCESS) {
-	pj_strdup2(global.pool, &global.name[global.name_cnt].host,
-		   pj_inet_ntoa(pri_addr.ipv4.sin_addr));
+	char addr[PJ_INET_ADDRSTRLEN];
+	pj_inet_ntop(pj_AF_INET(), &pri_addr.ipv4.sin_addr, addr,
+		     sizeof(addr));
+	pj_strdup2(global.pool, &global.name[global.name_cnt].host, addr);
 	global.name[global.name_cnt].port = global.port;
 	global.name_cnt++;
@@ -260,12 +262,16 @@
 
     /* Get the rest of IP interfaces */
-    if (pj_enum_ip_interface(pj_AF_INET(), &addr_cnt, addr_list) == PJ_SUCCESS) {
+    if (pj_enum_ip_interface(pj_AF_INET(), &addr_cnt, addr_list) == PJ_SUCCESS)
+    {
 	for (i=0; i<addr_cnt; ++i) {
-
+	    char addr[PJ_INET_ADDRSTRLEN];
+	    
 	    if (addr_list[i].ipv4.sin_addr.s_addr == pri_addr.ipv4.sin_addr.s_addr)
 		continue;
 
+	    pj_inet_ntop(pj_AF_INET(), &addr_list[i].ipv4.sin_addr, addr,
+	    		 sizeof(addr));
 	    pj_strdup2(global.pool, &global.name[global.name_cnt].host,
-		       pj_inet_ntoa(addr_list[i].ipv4.sin_addr));
+		       addr);
 	    global.name[global.name_cnt].port = global.port;
 	    global.name_cnt++;
Index: pjproject/trunk/pjsip-apps/src/samples/siprtp.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/siprtp.c	(revision 5310)
+++ pjproject/trunk/pjsip-apps/src/samples/siprtp.c	(revision 5311)
@@ -848,5 +848,5 @@
 static pj_status_t init_options(int argc, char *argv[])
 {
-    static char ip_addr[32];
+    static char ip_addr[PJ_INET_ADDRSTRLEN];
     static char local_uri[64];
 
@@ -893,6 +893,6 @@
 	hostname = pj_gethostname();
 	pj_sockaddr_in_init(&tmp_addr, hostname, 0);
-	addr = pj_inet_ntoa(tmp_addr.sin_addr);
-	pj_ansi_strcpy(ip_addr, addr);
+	pj_inet_ntop(pj_AF_INET(), &tmp_addr.sin_addr, ip_addr,
+        	     sizeof(ip_addr));
     }
 
Index: pjproject/trunk/pjsip-apps/src/samples/streamutil.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/streamutil.c	(revision 5310)
+++ pjproject/trunk/pjsip-apps/src/samples/streamutil.c	(revision 5311)
@@ -231,4 +231,5 @@
     pjmedia_port *stream_port;
     char tmp[10];
+    char addr[PJ_INET_ADDRSTRLEN];
     pj_status_t status; 
 
@@ -578,5 +579,6 @@
     else if (dir == PJMEDIA_DIR_ENCODING)
 	printf("Stream is active, dir is send-only, sending to %s:%d\n",
-	       pj_inet_ntoa(remote_addr.sin_addr),
+	       pj_inet_ntop2(pj_AF_INET(), &remote_addr.sin_addr, addr,
+        		     sizeof(addr)),
 	       pj_ntohs(remote_addr.sin_port));
     else
@@ -584,5 +586,6 @@
 	       "sending to %s:%d\n",
 	       local_port,
-	       pj_inet_ntoa(remote_addr.sin_addr),
+	       pj_inet_ntop2(pj_AF_INET(), &remote_addr.sin_addr, addr,
+        		     sizeof(addr)),
 	       pj_ntohs(remote_addr.sin_port));
 
Index: pjproject/trunk/pjsip-apps/src/samples/vid_streamutil.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/vid_streamutil.c	(revision 5310)
+++ pjproject/trunk/pjsip-apps/src/samples/vid_streamutil.c	(revision 5311)
@@ -348,4 +348,5 @@
     pjmedia_vid_stream *stream = NULL;
     pjmedia_port *enc_port, *dec_port;
+    char addr[PJ_INET_ADDRSTRLEN];
     pj_status_t status; 
 
@@ -860,5 +861,6 @@
     else if (dir == PJMEDIA_DIR_ENCODING)
 	printf("Stream is active, dir is send-only, sending to %s:%d\n",
-	       pj_inet_ntoa(remote_addr.sin_addr),
+               pj_inet_ntop2(pj_AF_INET(), &remote_addr.sin_addr, addr,
+        		     sizeof(addr)),
 	       pj_ntohs(remote_addr.sin_port));
     else
@@ -866,5 +868,6 @@
 	       "sending to %s:%d\n",
 	       local_port,
-	       pj_inet_ntoa(remote_addr.sin_addr),
+	       pj_inet_ntop2(pj_AF_INET(), &remote_addr.sin_addr, addr,
+        		     sizeof(addr)),
 	       pj_ntohs(remote_addr.sin_port));
 
Index: pjproject/trunk/pjsip/src/pjsip/sip_resolve.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_resolve.c	(revision 5310)
+++ pjproject/trunk/pjsip/src/pjsip/sip_resolve.c	(revision 5311)
@@ -169,6 +169,6 @@
     pj_in6_addr dummy6;
 
-    /* First check with inet_aton() */
-    if (pj_inet_aton(host, &dummy) > 0)
+    /* First check if this is an IPv4 address */
+    if (pj_inet_pton(pj_AF_INET(), host, &dummy) == PJ_SUCCESS)
 	return 4;
 
@@ -261,5 +261,5 @@
 		pj_sockaddr_init(pj_AF_INET(), &svr_addr.entry[0].addr, 
 				 NULL, 0);
-		pj_inet_aton(&target->addr.host,
+		pj_inet_pton(pj_AF_INET(), &target->addr.host,
 			     &svr_addr.entry[0].addr.ipv4.sin_addr);
 	    } else {
Index: pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c	(revision 5310)
+++ pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c	(revision 5311)
@@ -161,15 +161,7 @@
 	    rdata->pkt_info.zero = 0;
 	    pj_gettimeofday(&rdata->pkt_info.timestamp);
-	    if (src_addr->addr.sa_family == pj_AF_INET()) {
-		pj_ansi_strcpy(rdata->pkt_info.src_name,
-			       pj_inet_ntoa(src_addr->ipv4.sin_addr));
-		rdata->pkt_info.src_port = pj_ntohs(src_addr->ipv4.sin_port);
-	    } else {
-		pj_inet_ntop(pj_AF_INET6(), 
-			     pj_sockaddr_get_addr(&rdata->pkt_info.src_addr),
-			     rdata->pkt_info.src_name,
-			     sizeof(rdata->pkt_info.src_name));
-		rdata->pkt_info.src_port = pj_ntohs(src_addr->ipv6.sin6_port);
-	    }
+	    pj_sockaddr_print(src_addr, rdata->pkt_info.src_name,
+			      sizeof(rdata->pkt_info.src_name), 0);
+	    rdata->pkt_info.src_port = pj_sockaddr_get_port(src_addr);
 
 	    size_eaten = 
@@ -518,10 +510,10 @@
 		return status;
 
-	    pj_strcpy2(&bound_name->host, pj_inet_ntoa(hostip.ipv4.sin_addr));
+	    status = pj_inet_ntop(pj_AF_INET(), &hostip.ipv4.sin_addr,
+	    		 	  hostbuf, hostbufsz);
 	} else {
 	    /* Otherwise use bound address. */
-	    pj_strcpy2(&bound_name->host, 
-		       pj_inet_ntoa(tmp_addr.ipv4.sin_addr));
-	    status = PJ_SUCCESS;
+	    status = pj_inet_ntop(pj_AF_INET(), &tmp_addr.ipv4.sin_addr,
+	    		 	  hostbuf, hostbufsz);
 	}
 
@@ -543,7 +535,7 @@
 			      pj_sockaddr_get_addr(&tmp_addr),
 			      hostbuf, hostbufsz);
-	if (status == PJ_SUCCESS) {
-	    bound_name->host.slen = pj_ansi_strlen(hostbuf);
-	}
+    }
+    if (status == PJ_SUCCESS) {
+	bound_name->host.slen = pj_ansi_strlen(hostbuf);
     }
 
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 5310)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 5311)
@@ -3032,6 +3032,6 @@
     pj_in6_addr dummy6;
 
-    /* First check with inet_aton() */
-    if (pj_inet_aton(host, &dummy) > 0)
+    /* First check if this is an IPv4 address */
+    if (pj_inet_pton(pj_AF_INET(), host, &dummy) == PJ_SUCCESS)
 	return 4;
 
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 5310)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 5311)
@@ -2057,5 +2057,6 @@
 
     if (pjsua_var.stun_srv.addr.sa_family != 0) {
-	pj_ansi_strcpy(stun_ip_addr,pj_inet_ntoa(pjsua_var.stun_srv.ipv4.sin_addr));
+    	pj_sockaddr_print(&pjsua_var.stun_srv,
+    		     	  stun_ip_addr, sizeof(stun_ip_addr), 0);
 	stun_srv = pj_str(stun_ip_addr);
     } else {
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c	(revision 5310)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c	(revision 5311)
@@ -360,6 +360,5 @@
 	    pjstun_setting stun_opt;
 
-	    pj_ansi_strcpy(ip_addr,
-			   pj_inet_ntoa(pjsua_var.stun_srv.ipv4.sin_addr));
+	    pj_sockaddr_print(&pjsua_var.stun_srv, ip_addr,sizeof(ip_addr),0);
 	    stun_srv = pj_str(ip_addr);
 
@@ -427,6 +426,6 @@
 	    	if (status == PJ_SUCCESS) {
 		    if (pjsua_var.stun_srv.addr.sa_family != 0) {
-			pj_ansi_strcpy(ip_addr,
-			    pj_inet_ntoa(pjsua_var.stun_srv.ipv4.sin_addr));
+    			pj_sockaddr_print(&pjsua_var.stun_srv,
+    		     		     	  ip_addr, sizeof(ip_addr), 0);
 			stun_srv = pj_str(ip_addr);
 	    	    } else {
Index: pjproject/trunk/pjsip/src/test/transport_tcp_test.c
===================================================================
--- pjproject/trunk/pjsip/src/test/transport_tcp_test.c	(revision 5310)
+++ pjproject/trunk/pjsip/src/test/transport_tcp_test.c	(revision 5311)
@@ -38,4 +38,5 @@
     pj_status_t status;
     char url[PJSIP_MAX_URL_SIZE];
+    char addr[PJ_INET_ADDRSTRLEN];
     int rtt[SEND_RECV_LOOP], min_rtt;
     int i, pkt_lost;
@@ -58,5 +59,6 @@
 
     pj_ansi_sprintf(url, "sip:alice@%s:%d;transport=tcp",
-		    pj_inet_ntoa(rem_addr.sin_addr),
+		    pj_inet_ntop2(pj_AF_INET(), &rem_addr.sin_addr, addr,
+		    		  sizeof(addr)),
 		    pj_ntohs(rem_addr.sin_port));
 
Index: pjproject/trunk/pjsip/src/test/transport_test.c
===================================================================
--- pjproject/trunk/pjsip/src/test/transport_test.c	(revision 5310)
+++ pjproject/trunk/pjsip/src/test/transport_test.c	(revision 5311)
@@ -38,6 +38,7 @@
 	struct pj_in_addr addr;
 
-	/* Note: inet_aton() returns non-zero if addr is valid! */
-	if (pj_inet_aton(&tp->local_name.host, &addr) != 0) {
+	if (pj_inet_pton(pj_AF_INET(), &tp->local_name.host,
+			 &addr) == PJ_SUCCESS)
+	{
 	    if (addr.s_addr==PJ_INADDR_ANY || addr.s_addr==PJ_INADDR_NONE) {
 		PJ_LOG(3,(THIS_FILE, "   Error: invalid address name"));
