From: Marek P. <ma...@us...> - 2002-05-10 17:50:55
|
Update of /cvsroot/javaprofiler/library/src/commun In directory usw-pr-cvs1:/tmp/cvs-serv25366/src/commun Modified Files: communSocket.cpp Log Message: socket read fixes Index: communSocket.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/communSocket.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** communSocket.cpp 14 Mar 2002 00:08:43 -0000 1.14 --- communSocket.cpp 10 May 2002 17:50:50 -0000 1.15 *************** *** 239,249 **** else buf = new char[size]; ! rc = recv( _csock, buf, size, 0); #ifdef WIN32 ! _failed = (rc == SOCKET_ERROR || rc < size); #else ! _failed = (rc < 0 || rc < size); #endif if( !_failed) b.useBuffer( buf, size); --- 239,260 ---- else buf = new char[size]; ! char* p = buf; ! jint sz = size; ! ! while( sz) { ! ! rc = recv( _csock, p, sz, 0); #ifdef WIN32 ! _failed = (rc == SOCKET_ERROR); #else ! _failed = (rc < 0); #endif + + if( _failed) break; + + sz -= rc; + p += rc; + } if( !_failed) b.useBuffer( buf, size); |