Ticket #2885: connect.patch
File connect.patch, 1.1 KB (added by , 17 years ago) |
---|
-
libs/libmyth/mythsocket.cpp
6 6 #include "mythsocket.h" 7 7 #include <sys/select.h> 8 8 #include <cassert> 9 #include <netdb.h> 10 #include <arpa/inet.h> 9 11 10 12 #define SLOC(a) QString("MythSocket(%1:%2): ").arg((unsigned long)a, 0, 16)\ 11 13 .arg(a->socket()) … … 577 579 */ 578 580 bool MythSocket::connect(const QString &host, Q_UINT16 port) 579 581 { 582 VERBOSE(VB_GENERAL, "Entering connect with host"); 583 struct hostent *he; 584 in_addr * inaddr; 580 585 QHostAddress hadr; 581 hadr.setAddress(host); 586 if (hadr.setAddress(host)) 587 VERBOSE(VB_GENERAL, QString("Hostname was address %1: %2").arg(host).arg(hadr.toString())); 588 else 589 { 590 he = gethostbyname(host.ascii()); 591 inaddr=(in_addr *)he->h_addr_list[0]; 592 hadr.setAddress(inet_ntoa(* inaddr)); 593 VERBOSE(VB_GENERAL, QString("Found IP address for host %1: %2").arg(host).arg(hadr.toString())); 594 } 582 595 return MythSocket::connect(hadr, port); 583 596 } 584 597