QTcpServer - Fortune example problem
-
I all,
I am trying to run the fortune example (the simple client-server example) on windows but it is not working.
In a TCP viewer I see that a connection was established between server and client however the newConnection signal in the server side is not emmited.
In the client side I added the waitForConnected function but it results in timeout error.
I also checked the state and saw that it is HostLookupState.
In addition, I wrote a different server-client application not using QT and it works! (But I need to use QT)
So what am I doing wrong? Can someone solve the mistery?Thanks
-
Welcome to the forum.
You have to give some more details on your configuration (what windows, compiler, Qt version). Typically the examples are working, but certainly there is never a guarantee. For this specific eample, it is important to know also from where to where your are trying to make connection.
-
the actual Qt version is 4.7.3. So you might want to update to the newest version.
Out of curiosity I have just compiled the network example as is. It happened to be Qt 4.7.0. I did following:
Opened command prompt in vs2005
@
cd c:\qt\4.7.0\examples\network
qmake network.pro
nmake
@Started the debug versions of fortuneserver. This provides already your local ip address and supplies also a port. Start fortuneclient. This supplies also local ip address, but you have to input the port. It works.
You might want to do the same with your installation. I have seen that the example code of 4.5.2 is smaller, but I would need to recionfigure my whole setup for comiplation linking 4.5.2. So it could be that it is better to upgrade to recent version.
-
Do you have "vsaddin":http://developer.qt.nokia.com/wiki/QtVSAddin installed?
Installing vsaddin wil add an entry "Qt" to your menu in visual studio.
There is an option for opening *.pro files. You can do the same from within visual studio then. This generates a visual studio automatically as I remember. So, it would be basis for you to do some comparison and finding the reasons. -
[quote author="nnn123" date="1312113054"]I see that when I run the example from 'QT->Examples and Demos' it works. So I guess the problem is with the visual studio (compilation or project creation). Any idea?[/quote]
Did you do the recompilation as I have suggested? Check that you have really recompiled. Otherwise you might see the precomiled version working. This should not be a surprise.
If the recompilation does work, you might have messed something during your trials to setup the project through visual studio.BTW: It is Qt not QT (QuickTime) ;-)
-
I have the vsaddin installed however openning the pro file failes with error regarding to visual studio version.
I tried to open visual studio with devenv /useenv but it didn't work.
I didn't recompiled with make command since I don't have the gcc compiler on my computer.
Any other suggestions? -
I thought you want to use visual studio for compilation.
Make sure that you have installed the version of Qt libs. If you have already binaries for visual studio 2005 you can use those. If you do not have the binaries yet, the official download is for 2008 only. Those are not compatible as far as I know. So, you have to download the sources "here":http://qt.nokia.com/downloads/windows-cpp-vs2008 . This is the automatic download for the 2008 version, but the second on that page provides the source code. You can compile with vs2005. Follow the guidelines. There is only one stumble stone, which is that the command prompt has to be started from visual studio.
When you have installed that version. You can install and use vsaddin from vs2005.Alternatively, you may install the whole setup for gcc. Either way is possible. Since you seem to be familar with vs2005, you might want to go that route. However, that is up to you.
Unfortunately, you cannot compile Qt piece by piece and get it to work.
-
If you have a proper installation of Qt with visual studio, you should be able to compile the network example as I did. There is no need to have gcc installed. Your previous reply confused me a little then.
Open the command through visual studio tools.
Go to the example\network directory.
Start qmake and nmake afterwards as I have described above. If your installation is ok, you should be able to do so.
With the recompiled version you should also be able to check out the fortune server/client example. If this runs ok, the open question would be what is different to your initial approach. Either you have changed a part of the example program or the settings you have used are a problem. -
Assuming that you have started the command prompt through vs2005 it should work, when all settings are ok.
Therefore make sure that you did go in vs2005 to "tools" and there is an entry starting the command prompt with the vs environment. This is often forgotten, but it is essential. Otherwise nmake will fail. -
So I really don't know what can it be (and I really want to find it out).
I am sure I use the VS2005 command.
The nmake didn't work. When I look in the internet I saw that the files which are missing are VS2008 files. When I tried to create the vcproj from pro file I got an error relating to the Visual studio version. Because of those two reasons I thought that the problem is VS version.
Is there another way to convert pro file to vcproj? -
You should provide the error messages you got.
However, it looks that we are mixing up things.
Here you wrote:
[quote author="nnn123" date="1312177600"]qmake works. nmake doesn't work.[/quote]This is before any .vproj file. That was your reply on recompilation of the fortune example. This should be a trial with the command prompt started through visual studio. If nmake does not work in the command window opened through visual studio, there is a problem with your visual studio setup.
What is happening when you open the command prompt through visual studio and you simply type nmake?
Please post the messages obtained. -
It is missing a standard header file. So there is something with your environment wrong.
In your command prompt you can run "set include". There you should find the directory where this file is located. This entry is probably missing.However, in general I would suggest that you repair or reinstall your visual studio including all service packs. Then you should install Qt and vsaddin again.
The problems you have are not Qt related. It just happened to show up with your trials with the fortune server/client example.