From: Lin Y. <id...@gm...> - 2011-02-19 17:25:35
|
in mfscommon/sockets.c : line 381 int32_t tcptoread(int sock,void *buff,uint32_t leng,uint32_t msecto) { uint32_t rcvd=0; int i; struct pollfd pfd; pfd.fd = sock; pfd.events = POLLIN; while (rcvd<leng) { pfd.revents = 0; if (poll(&pfd,1,msecto)<0) { return -1; } if (pfd.revents & POLLIN) { i = read(sock,((uint8_t*)buff)+rcvd,leng-rcvd); if (i<=0) { //this code work only in Long Connection without EOF return i; } rcvd+=i; } else { errno = ETIMEDOUT; return -1; } } return rcvd; } ------------------------------------------------- should be replaced with : if (i==0) { //EOF return rcvd; } if (i<0) { return i; } -- 杨林 中科院计算技术研究所 15811038200 id...@gm... http://idning.javaeye.com/ |