Results 1 to 14 of 14

Thread: QT4.2.2 and QTcpSocket

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    128
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 28 Times in 27 Posts

    Default Re: QT4.2.2 and QTcpSocket

    Quote Originally Posted by Nyphel View Post
    Hello,

    I had several problems using the QTcpSocket, and I can't find examples of code that use the QTcpSocket in order to access a server with IMAP.
    Do you have a sample code, please ?
    I have non for imap, but there are a lot if QTcpSocket examples in the Trolltech documentation.

    Or just google a bit. I found for example mailody, an KDE-Imap client.
    Or search via Google Codesearch.
    A simple search produced for example this file which seems to be an inbox checker for imap written in Qt.

    Just remember, if you let yourself inspire by other code...honor the license and do not copy code...unless allowed by the license of course :-)

    Quote Originally Posted by Nyphel View Post
    Or, perhaps, do you know where to find more informations ?
    On what? QTcpSocket? Best use the Trolltech docs ;-)
    IMAP? Check the RFC?

    Quote Originally Posted by Nyphel View Post
    PS : The following code throws me stranges errors :
    - "undefined reference to _imp___ZN10QTcpSocketC1EP7QObject"
    Do you use qmake?
    Add "QT += network" to you pro file. It looks as if the network lib is not linked to your app.

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

    Nyphel (22nd February 2007)

  3. #2
    Join Date
    Feb 2007
    Posts
    158
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    25

    Default Re: QT4.2.2 and QTcpSocket

    Thanks a lot !

    The "QT += network" doesn't make anything better
    Perhaps my Qt installation is bad... I'll try to see it.

    Google Code Search is too usefull !
    It's the first time I hear baout it, thanks !

    Sorry if I let think that I didn't search a lot, but my QtAssistant doesn't display me the file and I didn't know Google Code Search... So it was a bit difficult

  4. #3
    Join Date
    Jan 2006
    Posts
    128
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 28 Times in 27 Posts

    Default Re: QT4.2.2 and QTcpSocket

    Quote Originally Posted by Nyphel View Post
    Google Code Search is too usefull !
    It's the first time I hear baout it, thanks !
    That's why I mentioned it...how does this old proverb go...
    Give a man a fish, and he will eat for a day,
    Teach a man to fish, and he will eat for a lifetime.



    Regarding your linking problem, I sadly have no idea what it could be...probably someone else does though :-)

  5. #4
    Join Date
    Oct 2006
    Posts
    60
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11
    Thanks
    9
    Thanked 3 Times in 3 Posts

    Default Re: QT4.2.2 and QTcpSocket

    I was able to compile the following code:
    Qt Code:
    1. #include <QTcpSocket>
    2. #include <QApplication>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication app(argc, argv);
    7. QTcpSocket * socket = new QTcpSocket();
    8. socket->connectToHost("imap.free.fr", 143);
    9. return app.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

    With this pro file:
    Qt Code:
    1. ######################################################################
    2. # Automatically generated by qmake (2.01a) Fri Feb 23 09:05:34 2007
    3. ######################################################################
    4.  
    5. QT += network
    6. TEMPLATE = app
    7. TARGET =
    8. DEPENDPATH += .
    9. INCLUDEPATH += .
    10.  
    11. # Input
    12. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 

    mAx

  6. #5
    Join Date
    Feb 2007
    Posts
    158
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    25

    Default Re: QT4.2.2 and QTcpSocket

    Thanks, the error was that my "qpake -project" doesn't add "QT += network" to my .pro file.

    I don't know how to solve that problem, but now I know that I can use the Sockets

  7. #6
    Join Date
    Jan 2006
    Posts
    128
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 28 Times in 27 Posts

    Default Re: QT4.2.2 and QTcpSocket

    Quote Originally Posted by Nyphel View Post
    Thanks, the error was that my "qpake -project" doesn't add "QT += network" to my .pro file.

    I don't know how to solve that problem, but now I know that I can use the Sockets
    Well, you only use qmake -project once (at least that is what it is intendet for from what I gather), and from then on you simply modify the ".pro" file by hand.

    The project file that qmake return is just a very rudimentary thing, and the .pro syntax is not too hard :-)

  8. #7
    Join Date
    Jun 2006
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows
    Thanked 1 Time in 1 Post

    Default Re: QT4.2.2 and QTcpSocket

    From command-line:
    Qt Code:
    1. qmake -project "QT = core gui network"
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. problem with QTcpSocket
    By SuperSonik in forum Qt Programming
    Replies: 8
    Last Post: 31st January 2007, 17:00
  2. Problems with QThread and QTcpSocket
    By cookiem in forum Qt Programming
    Replies: 6
    Last Post: 2nd November 2006, 09:25
  3. Problem with QTcpSocket and QDataStream
    By Valheru in forum Qt Programming
    Replies: 4
    Last Post: 16th September 2006, 14:08
  4. QTcpSocket - How do I know when it is disconnected ?
    By probine in forum Qt Programming
    Replies: 2
    Last Post: 3rd April 2006, 22:05
  5. QTcpSocket disconnection problem
    By erdi in forum Qt Programming
    Replies: 4
    Last Post: 19th February 2006, 22:50

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.