PIEthernet timeout on Windows fix

git-svn-id: svn://db.shs.com.ru/pip@138 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2015-05-27 16:49:14 +00:00
parent bf9c32000d
commit 7f473fe584

View File

@@ -300,11 +300,15 @@ void PIEthernet::applyTimeouts() {
void PIEthernet::applyTimeout(int fd, int opt, double ms) {
if (fd == 0) return;
//piCoutObj << "setReadIsBlocking" << yes;
#ifdef WINDOWS
DWORD tm = ms;
#else
double s = ms / 1000.;
timeval tm;
tm.tv_sec = piFloord(s); s -= tm.tv_sec;
tm.tv_usec = s * 1000000.;
//piCoutObj << "setReadIsBlocking" << yes;
#endif
ethSetsockopt(fd, SOL_SOCKET, opt, &tm, sizeof(tm));
}