PDA

View Full Version : QT Network



csvivek
1st April 2008, 17:19
I have the following classes
A,B,and C.
i have multiple inheritance approach in classes A and C.
A is a class that inherits a widget.(these are genrated by uic)
C is a class that inherits a Mainwindow.(these are genrated by uic)
from main i create an object to A from A i create an object to B to make a tcp connection with the server.
when the connection is established i close the widget with (close() call ) from class A and then call Class C i.e., Mainwindow.
now if want to use the connection that is established with the server how will i do it?

i just tried by creating an object from Class C to Class B and accessing the socket.
but the number of bytes written to the socket is -1 and the socket descriptor value is also -1 and the socket state in 0(UnConnected State).
so i tried to set the socket descriptor to the value that was there, when the connection was in an connected state. now the data is sent to the server and the window says:
SocketNotifier: Invalid socket 9 and type 'Read', disabling...

where 9 is the socket descriptor value that is set.

the socket descriptor variable i tried to use for both the class was a static member of the class.
can any of pls tell me how to maintain the connection when the windows are changed.
and where we use new classes.
this is because i want the module C to be the base communication module for whatever window i create.

Thanks in advance.....