[PyKDE] PyQt-3.0 QSocket.setSocket closes connection

Michael Ferraro michael at possibleworlds.com
Wed Nov 28 17:07:42 GMT 2001


Hello -

I'm new to PyQt/Qt so please forgive my ignorance.

I have searched the archive but found no reference to
a probem I'm having with QSocketServer and QSocket
I would be most grateful for any insights or help with this

I have built a small app that uses QSocketServer to listen
for connections and implements newConnection to set up
a socket to perform the communication with a client.

When QServerSocket.newConnection () is called an int
socket number (fd) is in fact passed, but when I call
the setSocket method of a QSocket instanced in
QServerSocket.newConnection(),  the client reports
that it is connected to the server and immediatly after
that the connection has been  closed by the server.

I am using the Qt example client as my test client
and have  verified that it works with the example server

class NohServer (QServerSocket):
    def __init__ (self):
        QServerSocket.__init__ (self, 5001, 3)

    def newConnection (self, sockfd):
        socket = QSocket ()
        socket.setSocket (sockfd)                # causes client to
report connection closed
        print socket.address().toString()      # prints address of this
machine

without the call to setSocket the client reports that
it connected to server.

I'm running on an SGI/O2 512Mb under IRIX6.5
with Qt-3.0 and PyQt-3.0 and Python 2.1

thanks


Michael








More information about the PyQt mailing list