Page 1 of 2 12 LastLast
Results 1 to 20 of 22

Thread: Socket programming, please help me!

  1. #1
    Join Date
    Nov 2009
    Posts
    59
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    20
    Thanked 1 Time in 1 Post

    Default Socket programming, please help me!

    My problem is that.
    I need to develop a programming connect to server to get Video, but server request UserName, PassWord. I don't know how to slove this. I use QtcpSocket
    thanks so much

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Socket programming, please help me!

    Without knowing the transmission protocol nor your code there is nothing we can do for you.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2009
    Posts
    59
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    20
    Thanked 1 Time in 1 Post

    Default Re: Socket programming, please help me!

    thanks
    this is my code
    Qt Code:
    1. void Hello::connect(char* serverName, int port){
    2. QTcpSocket socket;
    3. socket.setProxy(QNetworkProxy(QNetworkProxy::DefaultProxy, serverName,port,"userName","passWord"));
    4. //socket.connectToHost(serverName,port);
    5. if(socket.waitForConnected(6000)==true)
    6. {
    7. qDebug()<<"Successfully";
    8. }
    9. else{
    10. qDebug()<<socket.errorString();
    11. return;
    12. }
    To copy to clipboard, switch view to plain text mode 
    if we don't have userName,passWord everyone can connect and get my private data?
    thanks

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 268 Times in 268 Posts
    Wiki edits
    20

    Default Re: Socket programming, please help me!

    Still not enough information. What kind of protocol do you want to use? Http, Ftp, Nntp, ... ?

  5. #5
    Join Date
    Nov 2009
    Posts
    59
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    20
    Thanked 1 Time in 1 Post

    Default Re: Socket programming, please help me!

    Quote Originally Posted by tbscope View Post
    Still not enough information. What kind of protocol do you want to use? Http, Ftp, Nntp, ... ?
    TCP
    thanks

  6. #6
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 268 Times in 268 Posts
    Wiki edits
    20

    Default Re: Socket programming, please help me!

    No, what do you use on top of TCP?

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Socket programming, please help me!

    Quote Originally Posted by nthung View Post
    TCP
    This is transport protocol. We are asking for application protocol.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Nov 2009
    Posts
    59
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    20
    Thanked 1 Time in 1 Post

    Default Re: Socket programming, please help me!

    Quote Originally Posted by tbscope View Post
    No, what do you use on top of TCP?
    thanks, i dont konw more, but with my code do you fix it for me?
    I think the top of TCP used is FTP
    thanks and i have you fix my code
    thanks agian

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Socket programming, please help me!

    Quote Originally Posted by nthung View Post
    thanks, i dont konw more, but with my code do you fix it for me?
    I think the top of TCP used is FTP
    thanks and i have you fix my code
    We will not fix your code. You didn't provide enough information. Even if you did, we would still not fix your code but instead help you fix your own code. But this is meaningless since you don't even know what you are doing...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #10
    Join Date
    Nov 2009
    Posts
    59
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    20
    Thanked 1 Time in 1 Post

    Default Re: Socket programming, please help me!

    Quote Originally Posted by wysota View Post
    We will not fix your code. You didn't provide enough information. Even if you did, we would still not fix your code but instead help you fix your own code. But this is meaningless since you don't even know what you are doing...
    i think that protocol is FTP
    thanks

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Socket programming, please help me!

    Quote Originally Posted by nthung View Post
    i think that protocol is FTP
    Then I think you may want to use some higher level class such as QNetworkAccessManager or QFtp instead of QTcpSocket as I think you know FTP protocol requires at least two sockets.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. #12
    Join Date
    Nov 2009
    Posts
    59
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    20
    Thanked 1 Time in 1 Post

    Default Re: Socket programming, please help me!

    Quote Originally Posted by wysota View Post
    Then I think you may want to use some higher level class such as QNetworkAccessManager or QFtp instead of QTcpSocket as I think you know FTP protocol requires at least two sockets.
    yes but i have to use QTcpSocket
    thanks, fix it for me
    thanks agian

  13. #13
    Join Date
    Aug 2009
    Location
    Greece, Chania
    Posts
    63
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanked 11 Times in 11 Posts

    Default Re: Socket programming, please help me!

    Quote Originally Posted by nthung View Post
    thanks, fix it for me
    I don't know if this is a homework or not but this quote from C++ FAQ LITE gives the general idea:

    "If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm."

    Read the documentation then do it yourself. If you get stuck, ask a specific question!!!
    Misha R.evolution - High level Debugging IDE

    Programming is about 2 basic principles: KISS and RTFM!!!

  14. #14
    Join Date
    Nov 2009
    Posts
    59
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    20
    Thanked 1 Time in 1 Post

    Default Re: Socket programming, please help me!

    Quote Originally Posted by Archimedes View Post
    I don't know if this is a homework or not but this quote from C++ FAQ LITE gives the general idea:

    "If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm."

    Read the documentation then do it yourself. If you get stuck, ask a specific question!!!
    thanks but i am a programmer, i have been working for 2 years, i graduated since 2006 at PTIT in Vietnam
    my leader requests me that convert a VC++ project to Qt project, i am new to Qt
    thanks

  15. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Socket programming, please help me!

    Quote Originally Posted by nthung View Post
    thanks but i am a programmer, i have been working for 2 years, i graduated since 2006 at PTIT in Vietnam
    my leader requests me that convert a VC++ project to Qt project, i am new to Qt
    thanks
    And your leader told you you had to use a bare QTcpSocket for FTP? Or did your leader tell you he *thought* the protocol in use was FTP? Maybe you should present him the paragraph from C++ FAQ Lite, especially the part about doing projects together?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  16. #16
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: Socket programming, please help me!

    Then you need to figure out how the VC++ project uses FTP, and see if you can replace that code with QFTP class. Once you have done that research, if it does not work for you, state why and maybe we can help.

  17. #17
    Join Date
    Nov 2009
    Posts
    59
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    20
    Thanked 1 Time in 1 Post

    Default Re: Socket programming, please help me!

    Quote Originally Posted by wysota View Post
    And your leader told you you had to use a bare QTcpSocket for FTP? Or did your leader tell you he *thought* the protocol in use was FTP? Maybe you should present him the paragraph from C++ FAQ Lite, especially the part about doing projects together?
    My leader tells me the problem, then i consider mysefl to slove.
    Really, this is the first time i program about Socket, althought that i leanrt about socket programming in University before, so i dont clearly understand about TCP's working fundation
    thanks
    Last edited by nthung; 26th May 2010 at 18:45.

  18. #18
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Socket programming, please help me!

    Quote Originally Posted by nthung View Post
    My leader tells me the problem, then i consider mysefl to slove.
    So who asked you to use QTcpSocket?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  19. #19
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: Socket programming, please help me!

    Quote Originally Posted by wysota View Post
    So who asked you to use QTcpSocket?
    I'm assuming, the Visual Studio project. 1 -> 1 conversion.

  20. #20
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Socket programming, please help me!

    If this program indeed uses FTP (which is yet to be confirmed, as the author only thinks it does), I strongly doubt they used bare sockets for this and not some Windows library for handling the protocol.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Can any One help me? - Socket Programming?
    By vinod in forum Qt Programming
    Replies: 6
    Last Post: 18th November 2009, 10:46
  2. sending structure through udp socket programming
    By hemrajn in forum Qt Programming
    Replies: 9
    Last Post: 16th May 2009, 00:55
  3. Very strange socket programming problem
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 11th November 2008, 13:05
  4. Network Socket Programming
    By Walsi in forum Newbie
    Replies: 4
    Last Post: 19th June 2007, 11:04
  5. Problems in socket programming
    By vinod in forum Qt Programming
    Replies: 1
    Last Post: 7th March 2006, 09:09

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.