Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To me this sounds like an exception being thrown for a legitimate reason, and during stack unwinding some object's (possibly the <code>ClientSocket</code>'s?) destructor throws. Since the runtime cannot resolve this situation in any meaningful way (two exceptions "thrown" at the same time), the <code>terminate</code> function is called and the program is shut down.</p> <p>The unanswered question is why some destructor would throw if the object it belongs to is allocated on the stack. But to answer this question requires more data. Perhaps you can dig a little deeper and test my hypothesis?</p> <p>By the way, if this is indeed the case, and since <em>no destructor should <a href="http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.9" rel="nofollow noreferrer">ever</a> <a href="http://www.gotw.ca/gotw/047.htm" rel="nofollow noreferrer">throw</a> <a href="https://stackoverflow.com/q/130117/50079">anything</a></em>, we can conclude that the offending class is fatally flawed.</p> <p><strong>Update</strong>: seems I was on the money.</p> <p>Your class <code>Socket</code>'s destructor calls <code>close</code>, and <code>close</code> can throw. This is a serious programming error. You should wrap the <code>close</code> call in the destructor in</p> <pre><code>try { close(); } catch(...) { /* this space intentionally left blank */ } </code></pre> <p>and the crash will go away.</p> <p><strong>Second update (not crashing anymore)</strong></p> <p>If <code>recv</code> is returning -1, this means that the socket is in non-blocking mode and there is no data currently available to be received. That's not an error, but a feature. You shouldn't be throwing an exception there. What you <em>should</em> be doing exactly depends on whether you want to use the socket in blocking or non-blocking mode.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload