+ if(!videoSock->bind(QHostAddress::Any,5555)) qDebug() << "VideoThread::VideoThread ** Cant Bind to port 5555 ***" << videoSock->errorString();
+ QList<QNetworkConfiguration> netconfs=QNetworkConfigurationManager().allConfigurations();
+ foreach (QNetworkConfiguration np,netconfs) {
+ qDebug() << "network Confifuration name " << np.name() << np.bearerName() << np.bearerTypeName();
+ QNetworkSession ns(np);
+ if(ns.interface().addressEntries().empty())
+ qDebug() << "network session " << ns.interface().humanReadableName() << "**NotConfig**";
+ else {
+ qDebug() << "network session " << ns.interface().humanReadableName() << ns.interface().addressEntries().first().ip();
+ // Ubuntu may give wlan0 as "Ethernet"
+ if((np.bearerName()==QString("WLAN")) || (ns.interface().humanReadableName()==QString("wlan0")) ) {
+ my_ip=ns.interface().addressEntries().first().ip().toString();
+ qDebug() << "My IP is " << my_ip;
+ }
+ }
+ }
+ // Qt 4.7.x
+ imreq.imr_multiaddr.s_addr=inet_addr("224.1.1.1");
+ imreq.imr_interface.s_addr=inet_addr(my_ip.toAscii());
+ setsockopt(videoSock->socketDescriptor(),IPPROTO_IP,IP_ADD_MEMBERSHIP,&imreq,sizeof(imreq));
+//#else
+ // Qt 4.8
+ if(!videoSock->joinMulticastGroup(QHostAddress("224.1.1.1")))
+ qDebug() << "VideoThread::VideoThread can't join multicast Group 224.1.1.1" << videoSock->errorString();
+//#endif