c++ - Winsock invalid received byte number -
i'm facing winsock related problem when trying validate number of received bytes. in application i'm using non-blocking socket in order throw own timeout exception. here according code initialization of winsock : // initialize winsock wsadata winsockdata; word dllversion = makeword(2, 1); long iresult = wsastartup(dllversion, &winsockdata); if (iresult != no_error) return; addrinfo* serveraddress = nullptr; addrinfo* ptr = nullptr, hints; zeromemory(&hints, sizeof(hints)); hints.ai_family = af_inet; hints.ai_socktype = sock_stream; hints.ai_protocol = ipproto_tcp; iresult = getaddrinfo("127.0.0.1", "10011", &hints, &serveraddress); if (iresult != 0) return; // create communication socket socket connectsocket = socket(af_inet, sock_stream, /*ipproto_tcp*/0); if (connectsocket == invalid_socket) return; // establish connection server iresult = connect(connectsocket, serveraddress->ai_addr, (int)serveraddress->ai_...