Timeout not infinite for client reads after sending

This commit is contained in:
Stefan Persson 2010-10-21 14:52:24 +00:00
parent 48a055a061
commit 8da5bf1ae5
3 changed files with 7 additions and 2 deletions

View file

@ -78,6 +78,10 @@ void Socket::stopReadWait(){
}
std::wstring Socket::read() {
return read(INFINITE);
}
std::wstring Socket::read(int timeout){
wchar_t buf[BUFSIZE];
int result;
DWORD cbBytesRead = 0;
@ -91,7 +95,7 @@ std::wstring Socket::read() {
ReadFile( d->hPipe, &buf, sizeof(wchar_t)*BUFSIZE, &cbBytesRead, &oOverlap);
result = WaitForSingleObject(oOverlap.hEvent, INFINITE);
result = WaitForSingleObject(oOverlap.hEvent, timeout);
if(!d->running){
CloseHandle(d->readEvent);