Results 1 to 10 of 10

Thread: QTcpSocket exception.

  1. #1
    Join Date
    Jul 2007
    Location
    BY.Minsk
    Posts
    90
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default QTcpSocket exception.

    I'am have exception in this code:

    Qt Code:
    1. void CSSocket::incomingData()
    2. {
    3.  
    4. char szData[4097];
    5.  
    6. qint16 nRead = this->read(szData, 4096);
    7.  
    8. if(nRead == 0)
    9. {
    10. this->disconnectFromHost(); // <-------- Exception !
    11. this->close();
    12. return;
    13. }
    14. .....
    15. .....
    16. .....
    17. }
    To copy to clipboard, switch view to plain text mode 

    why ???

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

    Default Re: QTcpSocket exception.

    What kind of exception? Could you provide more information?

  3. #3
    Join Date
    Jul 2007
    Location
    BY.Minsk
    Posts
    90
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTcpSocket exception.

    Quote Originally Posted by wysota View Post
    What kind of exception? Could you provide more information?
    Qt Code:
    1. Unhandled exception at 0x64026dfa (QtNetworkd4.dll) in
    2. QMamManager.exe: 0xC0000005:
    3. Access violation writing location 0xfeeefeee.
    To copy to clipboard, switch view to plain text mode 

    in -> d:\qt4\src\network\qhostaddress.cpp

    Qt Code:
    1. void QHostAddressPrivate::clear()
    2. {
    3. a = 0; // <-
    4. protocol = QAbstractSocket::UnknownNetworkLayerProtocol;
    5. isParsed = true;
    6. memset(&a6, 0, sizeof(a6));
    7. }
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: QTcpSocket exception.

    Could you provide the back trace (call stack) from the debugger?

  5. #5
    Join Date
    Jul 2007
    Location
    BY.Minsk
    Posts
    90
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTcpSocket exception.

    Quote Originally Posted by wysota View Post
    Could you provide the back trace (call stack) from the debugger?
    autos
    - this 0xfeeefeee {a=??? a6={...} protocol=??? ...} QHostAddressPrivate * const
    a CXX0030: Error: expression cannot be evaluated
    + a6 {c=0xfeeefef2 <Bad Ptr> } QIPv6Address
    protocol CXX0030: Error: expression cannot be evaluated
    + ipString {??? size=???} QString
    isParsed CXX0030: Error: expression cannot be evaluated
    + scopeId {??? size=???} QString
    call stack
    > QtNetworkd4.dll!QHostAddressPrivate::clear() Line 242 + 0x3 bytes C++
    QtNetworkd4.dll!QHostAddress::clear() Line 437 C++
    QtNetworkd4.dll!QAbstractSocket::disconnectFromHos tImplementation() Line 2085 C++
    QtNetworkd4.dll!QAbstractSocket::qt_metacall(QMeta Object::Call _c=InvokeMetaMethod, int _id=10, void * * _a=0x00126c64) Line 105 + 0x8 bytes C++
    QtNetworkd4.dll!QTcpSocket::qt_metacall(QMetaObjec t::Call _c=InvokeMetaMethod, int _id=17, void * * _a=0x00126c64) Line 56 + 0x14 bytes C++
    QMamManager.exe!CSSocket::qt_metacall(QMetaObject: :Call _c=InvokeMetaMethod, int _id=17, void * * _a=0x00126c64) Line 60 + 0x15 bytes C++
    QtCored4.dll!QMetaObject::invokeMethod(QObject * obj=0x00a8e220, const char * member=0x64067ce4, Qt::ConnectionType type=DirectConnection, QGenericReturnArgument ret={...}, QGenericArgument val0={...}, QGenericArgument val1={...}, QGenericArgument val2={...}, QGenericArgument val3={...}, QGenericArgument val4={...}, QGenericArgument val5={...}, QGenericArgument val6={...}, QGenericArgument val7={...}, QGenericArgument val8={...}, QGenericArgument val9={...}) Line 973 + 0x1a bytes C++
    QtCored4.dll!QMetaObject::invokeMethod(QObject * obj=0x00a8e220, const char * member=0x64067ce4, QGenericArgument val0={...}, QGenericArgument val1={...}, QGenericArgument val2={...}, QGenericArgument val3={...}, QGenericArgument val4={...}, QGenericArgument val5={...}, QGenericArgument val6={...}, QGenericArgument val7={...}, QGenericArgument val8={...}, QGenericArgument val9={...}) Line 363 + 0x72 bytes C++
    QtNetworkd4.dll!QAbstractSocket::disconnectFromHos t() Line 2016 + 0xd7 bytes C++
    QMamManager.exe!CSSocket::incomingData() Line 74 C++
    QMamManager.exe!CSSocket::incomingData() Line 97 C++
    QMamManager.exe!CSSocket::qt_metacall(QMetaObject: :Call _c=InvokeMetaMethod, int _id=0, void * * _a=0x00129134) Line 65 + 0x8 bytes C++
    QtCored4.dll!QMetaObject::activate(QObject * sender=0x00a8e220, int from_signal_index=4, int to_signal_index=4, void * * argv=0x00000000) Line 3063 + 0x46 bytes C++
    QtCored4.dll!QMetaObject::activate(QObject * sender=0x00a8e220, const QMetaObject * m=0x67204804, int local_signal_index=0, void * * argv=0x00000000) Line 3122 + 0x15 bytes C++
    QtCored4.dll!QIODevice::readyRead() Line 79 + 0x12 bytes C++
    QtNetworkd4.dll!QAbstractSocketPrivate::canReadNot ification() Line 545 C++
    QtNetworkd4.dll!QAbstractSocketPrivate::readNotifi cation() Line 55 + 0x12 bytes C++
    QtNetworkd4.dll!QAbstractSocketEngine::readNotific ation() Line 119 C++
    QtNetworkd4.dll!QReadNotifier::event(QEvent * e=0x001299cc) Line 913 C++
    QtGuid4.dll!QApplicationPrivate::notify_helper(QOb ject * receiver=0x00a90828, QEvent * e=0x001299cc) Line 3541 + 0x11 bytes C++
    QtGuid4.dll!QApplication::notify(QObject * receiver=0x00a90828, QEvent * e=0x001299cc) Line 3100 + 0x10 bytes C++
    QtCored4.dll!QCoreApplication::notifyInternal(QObj ect * receiver=0x00a90828, QEvent * event=0x001299cc) Line 516 C++
    QtCored4.dll!QCoreApplication::sendEvent(QObject * receiver=0x00a90828, QEvent * event=0x001299cc) Line 185 + 0x39 bytes C++
    QtCored4.dll!qt_internal_proc(HWND__ * hwnd=0x000403ae, unsigned int message=1024, unsigned int wp=5912, long lp=1) Line 241 + 0xf bytes C++
    user32.dll!7e368724()
    [Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
    user32.dll!7e368806()
    user32.dll!7e3689bd()
    user32.dll!7e368a00()
    QtCored4.dll!QEventDispatcherWin32::processEvents( QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 504 + 0x18 bytes C++
    QtGuid4.dll!QGuiEventDispatcherWin32::processEvent s(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 975 + 0x15 bytes C++
    QtCored4.dll!QCoreApplication::processEvents(QFlag s<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 666 C++
    QMamManager.exe!CProjectManager::WaitRecived() Line 3994 + 0x10 bytes C++
    QMamManager.exe!CProjectManager::Autorization() Line 3134 C++
    QMamManager.exe!QMamManager::on_pushButton_clicked () Line 22 C++
    QMamManager.exe!QMamManager::qt_metacall(QMetaObje ct::Call _c=InvokeMetaMethod, int _id=0, void * * _a=0x0012becc) Line 66 + 0x8 bytes C++
    QtCored4.dll!QMetaObject::activate(QObject * sender=0x00a3d950, int from_signal_index=29, int to_signal_index=30, void * * argv=0x0012becc) Line 3063 + 0x46 bytes C++
    QtCored4.dll!QMetaObject::activate(QObject * sender=0x00a3d950, const QMetaObject * m=0x6576f0d4, int from_local_signal_index=2, int to_local_signal_index=3, void * * argv=0x0012becc) Line 3142 + 0x15 bytes C++
    QtGuid4.dll!QAbstractButton::clicked(bool _t1=false) Line 180 + 0x17 bytes C++
    QtGuid4.dll!QAbstractButtonPrivate::emitClicked() Line 517 C++
    QtGuid4.dll!QAbstractButtonPrivate::click() Line 509 C++
    QtGuid4.dll!QAbstractButton::mouseReleaseEvent(QMo useEvent * e=0x0012c500) Line 1086 C++
    QtGuid4.dll!QWidget::event(QEvent * event=0x0012c500) Line 6064 C++
    QtGuid4.dll!QAbstractButton::event(QEvent * e=0x0012c500) Line 1048 C++
    QtGuid4.dll!QPushButton::event(QEvent * e=0x0012c500) Line 651 C++
    QtGuid4.dll!QApplicationPrivate::notify_helper(QOb ject * receiver=0x00a3d950, QEvent * e=0x0012c500) Line 3541 + 0x11 bytes C++
    QtGuid4.dll!QApplication::notify(QObject * receiver=0x00a3d950, QEvent * e=0x0012c500) Line 3240 + 0x2f bytes C++
    QtCored4.dll!QCoreApplication::notifyInternal(QObj ect * receiver=0x00a3d950, QEvent * event=0x0012c500) Line 516 C++
    QtCored4.dll!QCoreApplication::sendSpontaneousEven t(QObject * receiver=0x00a3d950, QEvent * event=0x0012c500) Line 188 + 0x38 bytes C++
    QtGuid4.dll!QETWidget::translateMouseEvent(const tagMSG & msg={...}) Line 2757 + 0x14 bytes C++
    QtGuid4.dll!QtWndProc(HWND__ * hwnd=0x00040390, unsigned int message=514, unsigned int wParam=0, long lParam=917552) Line 1390 + 0xc bytes C++
    user32.dll!7e368724()
    user32.dll!7e368806()
    user32.dll!7e3689bd()
    user32.dll!7e368a00()
    QtCored4.dll!QEventDispatcherWin32::processEvents( QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 504 + 0x18 bytes C++
    QtGuid4.dll!QGuiEventDispatcherWin32::processEvent s(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 975 + 0x15 bytes C++
    QtCored4.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 125 C++
    QtCored4.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 170 + 0x2d bytes C++
    QtCored4.dll!QCoreApplication::exec() Line 735 + 0x15 bytes C++
    QtGuid4.dll!QApplication::exec() Line 3039 C++
    QMamManager.exe!main(int argc=1, char * * argv=0x003e7ee0) Line 10 + 0x6 bytes C++
    QMamManager.exe!WinMain(HINSTANCE__ * instance=0x00400000, HINSTANCE__ * prevInstance=0x00000000, char * __formal=0x00151f14, int cmdShow=1) Line 103 + 0x12 bytes C++
    QMamManager.exe!__tmainCRTStartup() Line 578 + 0x35 bytes C
    QMamManager.exe!WinMainCRTStartup() Line 403 C
    kernel32.dll!7c816ff7()
    Last edited by jacek; 29th January 2008 at 22:29. Reason: changed [code] to [quote]

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTcpSocket exception.

    Something might be wrong with your stack. 0xfeeefeee seems to be a stack based address. I'd start by recompiling all objects to make sure your application doesn't go into places it shouldn't.

  7. #7
    Join Date
    Jul 2007
    Location
    BY.Minsk
    Posts
    90
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTcpSocket exception.

    hmmm....
    If i'am send from server command for disconnect client, i'am get signal disconnected()
    Qt Code:
    1. connect(this, SIGNAL(disconnected()), this, SLOT(OnCls()));
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void CSSocket::OnCls()
    2. {
    3. CProjectManager::GetPrjMng()->Reset();
    4.  
    5. }
    To copy to clipboard, switch view to plain text mode 

    slot work fine... but after quit, i'am get exception in line d->localAddress.clear();

    Qt Code:
    1. #ifdef QT3_SUPPORT
    2. emit delayedCloseFinished(); // compat signal
    3. #endif
    4. emit disconnected();
    5.  
    6. d->localPort = 0;
    7. d->peerPort = 0;
    8. d->localAddress.clear(); <----
    9. d->peerAddress.clear();
    To copy to clipboard, switch view to plain text mode 

  8. #8
    Join Date
    Jul 2007
    Location
    BY.Minsk
    Posts
    90
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTcpSocket exception.

    Quote Originally Posted by wysota View Post
    Something might be wrong with your stack. 0xfeeefeee seems to be a stack based address. I'd start by recompiling all objects to make sure your application doesn't go into places it shouldn't.
    solved
    thank you for help !

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

    Default Re: QTcpSocket exception.

    What was wrong?

  10. #10
    Join Date
    Jul 2007
    Location
    BY.Minsk
    Posts
    90
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTcpSocket exception.

    Quote Originally Posted by wysota View Post
    What was wrong?
    It is my mistake... I tried to cause methods after removal m_pSSocket
    Qt Code:
    1. void CProjectManager::Reset()
    2. {
    3. CProjectManager::GetPrjMng()->m_pSSocket->disconnectFromHost(); // now ok
    4. CProjectManager::GetPrjMng()->m_pSSocket->close(); // now ok
    5.  
    6. //delete m_pSSocket; <--
    7. //m_pSSocket = NULL; <--
    8. ...
    9. ...
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QTcpSocket and libssh2 ...
    By sandros in forum Qt Programming
    Replies: 6
    Last Post: 21st November 2007, 22:34
  2. Exception type loss
    By azdruid in forum Qt Programming
    Replies: 3
    Last Post: 6th November 2007, 20:06
  3. Problem with QTcpSocket in QThread
    By Raistlin in forum Qt Programming
    Replies: 8
    Last Post: 6th October 2007, 12:23
  4. Strange QTcpSocket behavior (debugged with Ethereal)
    By mdecandia in forum Qt Programming
    Replies: 23
    Last Post: 28th May 2007, 20:44
  5. Exceptions and qApp->processEvents()
    By mcostalba in forum Qt Programming
    Replies: 3
    Last Post: 8th January 2006, 17:06

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.