I'm having trouble a non-blocking revc(). If I'm correct shall recv() return the amount of bytes revived at particular moment, and return 0 when EOF and –1 when error. My program connects to a web server and sends the "GET / HTTP1.1…." the the socket starts to receive data from the web server. But recv() NEVER returns 0 or –1. So the connection is never ended witch hangs the program there until the socket timeouts. Any ideas what can be wrong? Here's some code: FD_ZERO(&real_mask); FD_SET(wget_s.getSock(), &real_mask); tv.tv_sec = (long) 50000; tv.tv_usec = (long) 0; wget_s.set_non_blocking(true); struct pollfd poll_list[1]; int t, q; try { poll_list[0].fd = wget_s.getSock(); poll_list[0].events = POLLIN; t=0; q=1; while(t != 1) { cout << poll(poll_list,(unsigned long)1,-1) << endl; if(((poll_list[0].revents&POLLHUP) == POLLHUP) || ((poll_list[0].revents&POLLERR) == POLLERR) || ((poll_list[0].revents&POLLNVAL) == POLLNVAL)) { cout << "Mysko" << endl; return 0; } if((poll_list[0].revents&POLLIN) == POLLIN) { wget_s.set_non_blocking(false); cout << wget_s.recv(wget_data) << " RECV" << endl; cout << wget_s.send(" ") << " SEND" << endl; cout <<wget_data.find("0",0) << endl; cout << wget_data << endl; } } } catch (SocketException &e) { cout << "Exception" << endl; }