changeset 7513:cd2b939b2dfb

Display the IP address that has been resolved.
author bertrand
date Fri, 27 Sep 2002 19:20:20 +0000
parents 0df2e3079aa4
children d71300143887
files libmpdemux/network.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/network.c	Thu Sep 26 23:53:50 2002 +0000
+++ b/libmpdemux/network.c	Fri Sep 27 19:20:20 2002 +0000
@@ -149,8 +149,7 @@
 	fd_set set;
 	struct timeval tv;
 	struct sockaddr_in server_address;
-
-	mp_msg(MSGT_NETWORK,MSGL_STATUS,"Connecting to server %s:%d ...\n", host, port );
+	struct hostent *hp;
 
 	socket_server_fd = socket(AF_INET, SOCK_STREAM, 0);
 	if( socket_server_fd==-1 ) {
@@ -159,7 +158,7 @@
 	}
 
 	if( isalpha(host[0]) ) {
-		struct hostent *hp;
+		mp_msg(MSGT_NETWORK,MSGL_STATUS,"Resolving %s ...\n", host );
 		hp=(struct hostent*)gethostbyname( host );
 		if( hp==NULL ) {
 			mp_msg(MSGT_NETWORK,MSGL_ERR,"Counldn't resolve name: %s\n", host);
@@ -173,6 +172,11 @@
 	server_address.sin_port=htons(port);
 	
 	// Turn the socket as non blocking so we can timeout on the connection
+	if( isalpha(host[0]) ) {
+		mp_msg(MSGT_NETWORK,MSGL_STATUS,"Connecting to server %s[%d.%d.%d.%d]:%d ...\n", host, (hp->h_addr_list[0][0])&0xff, (hp->h_addr_list[0][1])&0xff, (hp->h_addr_list[0][2])&0xff, (hp->h_addr_list[0][3])&0xff, port );
+	} else {
+		mp_msg(MSGT_NETWORK,MSGL_STATUS,"Connecting to server %s:%d ...\n", host, port );
+	}
 	fcntl( socket_server_fd, F_SETFL, fcntl(socket_server_fd, F_GETFL) | O_NONBLOCK );
 	if( connect( socket_server_fd, (struct sockaddr*)&server_address, sizeof(server_address) )==-1 ) {
 		if( errno!=EINPROGRESS ) {