bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TCPtream bug


From: David Sugar
Subject: Re: TCPtream bug
Date: Wed, 02 Sep 2009 09:24:13 -0400
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Probably instead, connect methods should actually do this if the so is
invalid when they are called.  If we do fail to connect, we should
release the resource as we do now.  If we decide to close/delete the
object on a connect failure, then we would not be waisting resources
acquiring a brand new socket we may never use.  Part of this is also
tied to the use of connect as a constructor method, where the object is
then in a clean state with no socket held if the connect failed at
initialization.  But either way, I will look at resolving this for the
next release.

Vincent Chen wrote:
> hi,
> 
> I recently found TCPStream bug when performing TCPStream::open().
> here is my code:
> 
> TCPStream client;
> client.setTimeout(5000); //this will let connect() function be non-block
> while(1)
> {
>   client.connect(IPV4Host, port, buffer);
>   if(!client.isConnected())
>   {
>     ::usleep(1000000*3);
>     continue;
>   }
> }
> 
> Once the first run in connect() failed, it will keep connecting to
> indicated IP and port
> but the 2nd time it connect, will cause the socket error (I print out
> the errno)
> 
> I found the socket do not re-initialize when connect() failed.
> if add the code in line 3125
> 
>  so = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
> 
> it will work well
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Bug-commoncpp mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-commoncpp

Attachment: dyfet.vcf
Description: Vcard


reply via email to

[Prev in Thread] Current Thread [Next in Thread]