Results 1 to 4 of 4

Thread: QTcpSocket in QThread

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Location
    Russia, Moscow
    Posts
    35
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question QTcpSocket in QThread

    How to make QTcpSocket available from all functions in QThread class?

    I will add bandwidth to my application. All the operations for socket does in socketThread class.

    http://code.google.com/p/mediasrv/so.../trunk/src/srv

  2. #2
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTcpSocket in QThread

    Subclass QThread (let it be MyThread) and add a memeber of type QTcpSocket to MyThread class.
    I'm a rebel in the S.D.G.

  3. #3
    Join Date
    Feb 2008
    Location
    Russia, Moscow
    Posts
    35
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTcpSocket in QThread

    Quote Originally Posted by lyuts View Post
    Subclass QThread (let it be MyThread) and add a memeber of type QTcpSocket to MyThread class.

    How I can do this?

  4. #4
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTcpSocket in QThread

    Something like this.

    Qt Code:
    1. class MyThread : public Thread
    2. {
    3. public:
    4. MyThread(...);
    5.  
    6. private:
    7. QTcpSocket *mSocket;
    8. };
    To copy to clipboard, switch view to plain text mode 
    I'm a rebel in the S.D.G.

Similar Threads

  1. QThread and QTcpSocket
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 19th May 2008, 17:43
  2. QThread and QTcpSocket
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 12th May 2008, 13:06
  3. Problem with QTcpSocket in QThread
    By Raistlin in forum Qt Programming
    Replies: 8
    Last Post: 6th October 2007, 12:23
  4. Strange QTcpSocket behavior (debugged with Ethereal)
    By mdecandia in forum Qt Programming
    Replies: 23
    Last Post: 28th May 2007, 20:44
  5. Problems with QThread and QTcpSocket
    By cookiem in forum Qt Programming
    Replies: 6
    Last Post: 2nd November 2006, 08:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.