Results 1 to 20 of 36

Thread: Sending email using Qt.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Join Date
    Mar 2006
    Posts
    2
    Thanks
    2
    Thanked 6 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Sending email using Qt.

    Quote Originally Posted by blue.death
    Hi guys,

    I am working on a SMTP client too and I do quite the same things as in the Qt example (btw. I didnt remember there was such an example ).
    The problem is my app won't connect if I don't call waitForConnected()!

    But isnt this method useless if we wand non-blocking sockets?
    Other code examples simply call connectToHost(...) after setting up the right connections.
    If I don't call waitForConnected() the socket status remains on LookingUpHost (or whatever the exact name is)

    Any clue???

    The example was only in the QT 3.x series under networking examples, i just altered it to work in QT 4.x.

    My understanding of the "waitForConnected()" function is that it's simply a delay to allow a handshake to occur, it doesn't actually do anything unless you want to establish a timeout (lets say for a server that's offline) and take the bool return to do error correction.

    Basically it is a delay before completing the socket.

    I removed the "waitForConnected()" from my client and it established a connection immediately, but my mail server is also on the company lan and connects extremely quickly.

    Using the "waitForConnected()" function should have no effect on how you connect unless you choose to implement error correction based on it's return.

    If you don't want to use it then i suggest putting a delay in, something like 10-15 seconds, which is close to a worst case connection delay for most internet applications.

    Of course if you use "waitForConnected(15000)" then it will automatically stop the delay after either 15 seconds (a timeout) or you establish a connection (if it's less than the passed 15 seconds), which would make sense to minimize the time your application is waiting.

    J

  2. The following user says thank you to nielsenj for this useful post:

    marcovictor (8th October 2010)

Similar Threads

  1. Replies: 9
    Last Post: 23rd August 2012, 00:01
  2. Replies: 7
    Last Post: 5th January 2009, 08:27
  3. Sending Mail through QProcess
    By KaptainKarl in forum Qt Programming
    Replies: 6
    Last Post: 13th August 2008, 21:51
  4. sending encrypted data via mail using smtp
    By vermarajeev in forum General Programming
    Replies: 20
    Last Post: 14th August 2007, 19:47
  5. qt network performance
    By criss in forum Qt Programming
    Replies: 16
    Last Post: 24th July 2006, 09:23

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.