[Common-dev] Fwd: Re: Crash in CHXSocket. (when writing to a closed socket.)

[Common-dev] Fwd: Re: Crash in CHXSocket. (when writing to a closed socket.)

Liam Murray liamm at real.com
Thu Sep 23 17:51:54 PDT 2004


Writing to a socket after you close it is illogical. It seems the code that 
calls write after closing a socket should be fixed.

I wonder if the write methods should just have a check such as follows.

if (!m_pSendBuffer)
{
return HXR_UNEXPECTED; // or other ???
}

That seems like a more direct fix. The other seems like a masking fix. 
Maybe I'm being persnickety.

Liam

At 05:36 PM 9/23/2004, Tom Marshall wrote:
>On Thu, Sep 23, 2004 at 04:36:11PM -0700, Liam Murray wrote:
> >
> > This avoids the crash. How does Write() behave when you write to a closed
> > socket? Does it return an error code? It seems writing after close should
> > be an error.
>
>I suspect that write(), and therefore hx_write(), would return either
>(WSA)EBADF or (WSA)ENOTSOCK.  But I haven't actually tried.
>
>--
>Give a man a fish, and you feed him for a day.  Tell him he should learn how
>to fish himself, and he'll hate you for a lifetime.




More information about the Common-dev mailing list
 

Site Map   |   Terms of Use   |   Privacy Policy   |   Contact Us

Copyright © 1995-2007 RealNetworks, Inc. All rights reserved. RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.