bug-commoncpp
[Top][All Lists]
Advanced

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

TCPtream bug


From: Vincent Chen
Subject: TCPtream bug
Date: Sat, 29 Aug 2009 16:27:13 +0800

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

reply via email to

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