[Mplayer-cvslog] CVS: main/libmpdemux network.c,1.57,1.58
Bertrand Baudet
bertrand at mplayerhq.hu
Tue Sep 3 03:29:47 CEST 2002
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv7255
Modified Files:
network.c
Log Message:
Return -2 for fatal error while connecting to a server.
Fatal are unable to resolve name, connection timeout...
Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- network.c 14 Aug 2002 21:55:48 -0000 1.57
+++ network.c 3 Sep 2002 01:29:44 -0000 1.58
@@ -138,6 +138,8 @@
#endif
// Connect to a server using a TCP connection
+// return -2 for fatal error, like unable to resolve name, connection timeout...
+// return -1 is unable to connect to a particular port
int
connect2Server(char *host, int port) {
int socket_server_fd;
@@ -152,7 +154,7 @@
socket_server_fd = socket(AF_INET, SOCK_STREAM, 0);
if( socket_server_fd==-1 ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Failed to create socket\n");
- return -1;
+ return -2;
}
if( isalpha(host[0]) ) {
@@ -160,7 +162,7 @@
hp=(struct hostent*)gethostbyname( host );
if( hp==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Counldn't resolve name: %s\n", host);
- return -1;
+ return -2;
}
memcpy( (void*)&server_address.sin_addr.s_addr, (void*)hp->h_addr, hp->h_length );
} else {
@@ -191,7 +193,7 @@
mp_msg(MSGT_NETWORK,MSGL_ERR,"Connection timeout\n");
else
mp_msg(MSGT_NETWORK,MSGL_V,"Connection interuppted by user\n");
- return -1;
+ return -2;
}
count++;
FD_ZERO( &set );
@@ -207,7 +209,7 @@
ret = getsockopt(socket_server_fd,SOL_SOCKET,SO_ERROR,&err,&err_len);
if(ret < 0) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"getsockopt failed : %s\n",strerror(errno));
- return -1;
+ return -2;
}
if(err > 0) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Connect error : %s\n",strerror(err));
More information about the MPlayer-cvslog
mailing list