PDA

View Full Version : Need to use standard socket 'connect' and not QObject::connect!



the_bis
10th November 2006, 11:37
Hi,
I have to use standard C++ socket instead of QT QSocket object.
So I've used this code:



if (connect(socketDescriptor,
(struct sockaddr *) &serverAddress,
sizeof(serverAddress)) < 0) {
cerr << "cannot connect\n";
exit(1);
}


but this conflicts with a "QObject::connect" I use in an other part of my code.

So I have this error:



qtnclient.cpp: In member function ‘QString DeviceConfiguration::getValueFromServer(QString&, int&, QString&, DeviceConfiguration::configDatabyModule&)’:
qtnclient.cpp:484: error: no matching function for call to ‘DeviceConfiguration::connect(int&, sockaddr*, unsigned int)’
/usr/include/qt3/qobject.h:116: note: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*)
/usr/include/qt3/qobject.h:226: note: bool QObject::connect(const QObject*, const char*, const char*) const



I need to use "QObject::connect" in a part of my program but I need also to use the standard C/C++ "connect" in another part of my program...

Any help?
Thanks,
the_bis

Burgpflanze
10th November 2006, 12:01
this->connect() ?

the_bis
10th November 2006, 13:02
Same problem!
I'm using the same source file.
This source file begins like this:

#include <qapplication.h>
#include <qdatetimeedit.h>
#include <qdatetime.h>
#include <qobject.h>

#include <netdb.h>
#include <netinet/in.h>
#include <unistd.h>
#include <iostream>

Please help,
the_bis

jacek
10th November 2006, 13:05
Try:
::connect( ... );

the_bis
10th November 2006, 16:38
Try:
::connect( ... );

Yes!
It works!
Thank you very much,
the_bis