Results 1 to 20 of 27

Thread: Reading from TCP Socket crashes program

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Re: Reading from TCP Socket crashes program

    Sure! Lemme just figure out how to make MinGW do that

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Reading from TCP Socket crashes program

    Quote Originally Posted by OnionRingOfDoom
    Sure! Lemme just figure out how to make MinGW do that
    You need gdb for this.

    C:\...\gdb app.exe
    (gdb) run
    <program crashes>
    (gdb) bt
    <backtrace>
    (gdb) quit

  3. #3

    Default Re: Reading from TCP Socket crashes program

    Ok, lemme install this doohicky
    Last edited by OnionRingOfDoom; 26th January 2006 at 20:38.

  4. #4

    Default Re: Reading from TCP Socket crashes program

    #0 0x10047934 in _size_of_stack_reserve__ ()
    Cannot access memory at address 0x200000

    that's what it gave me.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Reading from TCP Socket crashes program

    Quote Originally Posted by OnionRingOfDoom
    #0 0x10047934 in _size_of_stack_reserve__ ()
    Cannot access memory at address 0x200000

    that's what it gave me.
    Only this? Maybe there was something more?

    If there is no main() in the backtrace, it might mean that there is some problem with libraries. Make sure you have "QT += network" in your .pro file.

  6. #6

    Default Re: Reading from TCP Socket crashes program

    Quote Originally Posted by jacek
    If there is no main() in the backtrace, it might mean that there is some problem with libraries. Make sure you have "QT += network" in your .pro file.
    Yep, QT += network" is in the .pro file.

    If you want, I can upload the entire source somewhere, and you can see what it does on your end?

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Reading from TCP Socket crashes program

    Quote Originally Posted by OnionRingOfDoom
    If you want, I can upload the entire source somewhere, and you can see what it does on your end?
    According to Murphy's law it will work on my system

    Does your program crash before it starts?

  8. #8

    Default Re: Reading from TCP Socket crashes program

    Quote Originally Posted by jacek
    According to Murphy's law it will work on my system

    Does your program crash before it starts?
    Nope, I have to start up the program in server mode, then start another instance of the program in client mode. As soon as I click OK on the connect dialog box after typing in the propper port and IP, the server indicates that the client has sucessfully connected, and then the client crashes.
    Last edited by OnionRingOfDoom; 26th January 2006 at 21:35.

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Reading from TCP Socket crashes program

    Quote Originally Posted by OnionRingOfDoom
    and then the client crashes.
    And there was only one entry in the backtrace? Did you compile your application in debug mode?

    Anyway, you try to read data from the socket before they arrive --- you must wait for readyRead() signal.

  10. #10

    Default Re: Reading from TCP Socket crashes program

    ...How do I compile it in debug mode?

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Reading from TCP Socket crashes program

    Quote Originally Posted by OnionRingOfDoom
    ...How do I compile it in debug mode?
    Add "CONFIG += debug" to your .pro file (and remove "release" if it's there).

  12. #12

    Default Re: Reading from TCP Socket crashes program

    Ok so I changed the connection to do the readSpeed() function whenever readyRead() was emitted. However, now nothing happens when the client connects.

    I also added a new connection at the end of the acceptConnection() function, which is as follows: connect(slider, SIGNAL(valueChanged(int)), this, SLOT(sendSpeed()));
    so now, whenever I move the slider (and it outputs valueChanged signal), it crashes.
    Last edited by OnionRingOfDoom; 26th January 2006 at 22:08.

  13. #13

    Default Re: Reading from TCP Socket crashes program

    After further fiddling, it seems that it's not the server's writing to the IO device that's the problem, it's the client's reading from the IO device that's causing the crash. Moving the slider thus causes the server to write data, and the client tries to read it or something, but crashes.

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Reading from TCP Socket crashes program

    Does it crash if you change MainWindow::readSpeed() to:
    Qt Code:
    1. void MainWindow::readSpeed()
    2. {
    3. label->setNum(0);
    4. }
    To copy to clipboard, switch view to plain text mode 
    ?

    Did you try to generate that backtrace again?

Similar Threads

  1. wrong connection? program crashes altough it compiles
    By cbarmpar in forum Qt Programming
    Replies: 7
    Last Post: 30th September 2008, 12:48
  2. Socket Reading Advice
    By tntcoda in forum Qt Programming
    Replies: 3
    Last Post: 4th July 2008, 11:26
  3. Program crashes with assert error in xcb_lock.c
    By Valheru in forum Qt Programming
    Replies: 3
    Last Post: 18th November 2007, 19:56
  4. QWT 5, QT3, SuSE 10.2. Crash and burn
    By DrMcCleod in forum Qwt
    Replies: 8
    Last Post: 7th September 2007, 20:53
  5. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 04:19

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.