Results 1 to 3 of 3

Thread: QTcpSocket with QTextStream

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Posts
    7
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    2

    Default QTcpSocket with QTextStream

    Hello everyone.
    I use qt 4.6.3 with visual studio 2010.

    I found a smtp class on the net, which I try to modify a little.
    Sadly I get the error:
    QSocketNotifier: socket notifiers cannot be enabled from another thread
    and the conversation with the smtp server stops.

    The error is shown after the function sendLine() is called from nextLine().
    After that, nothing happens anymore.
    Can someone tell me what I am doing wrong?

    stmp.cpp:
    http://codepad.org/r0RLf1sw

    smtp.h:
    http://codepad.org/fbAopRXs

    Thank you, Louis Hoefler

  2. #2
    Join Date
    Apr 2010
    Posts
    7
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    2

    Default Re: QTcpSocket with QTextStream

    I think I found the error, I do execute read and write asynchronously. If the server respondes with a bigger delay, I get errors.

  3. #3
    Join Date
    Apr 2010
    Posts
    7
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    2

    Default Re: QTcpSocket with QTextStream

    I solved the „stop conversation“ problem by inserting
    a smtpsocket->flush() into the sendLine() function.
    The warning about QSocketNotifier does still show up.

    Can someone give me a hint what I need to modify to
    remove that messages?
    Also the smtpsocket->waitForReadyRead(Timeout)
    function in run() never returns, only if I change the
    Timeout to a value <= 100, why?

    Thank you, Louis Hoefler.

Similar Threads

  1. QTextStream under Mac OS X
    By hunsrus in forum Qt Programming
    Replies: 0
    Last Post: 14th September 2009, 10:49
  2. QTextStream
    By WXNSNW in forum Qt Programming
    Replies: 1
    Last Post: 16th November 2008, 17:43
  3. reading from QTextStream
    By matyi52 in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 14th December 2006, 08:26
  4. Problem with QTextStream
    By eter in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2006, 16:54
  5. QTextStream help pls
    By munna in forum Newbie
    Replies: 5
    Last Post: 16th May 2006, 19:45

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
  •  
Qt is a trademark of The Qt Company.