mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-24 08:44:44 +01:00
Fixed network library which also fixes RTL-TCP source
This commit is contained in:
parent
fd65984762
commit
16eaa0cf59
@ -148,18 +148,21 @@ namespace net {
|
|||||||
// Create FD set
|
// Create FD set
|
||||||
fd_set set;
|
fd_set set;
|
||||||
FD_ZERO(&set);
|
FD_ZERO(&set);
|
||||||
FD_SET(sock, &set);
|
|
||||||
|
|
||||||
// Define timeout
|
|
||||||
timeval tv;
|
|
||||||
tv.tv_sec = 0;
|
|
||||||
tv.tv_usec = timeout * 1000;
|
|
||||||
|
|
||||||
int read = 0;
|
int read = 0;
|
||||||
bool blocking = (timeout != NONBLOCKING);
|
bool blocking = (timeout != NONBLOCKING);
|
||||||
do {
|
do {
|
||||||
// Wait for data or error if
|
// Wait for data or error if
|
||||||
if (blocking) {
|
if (blocking) {
|
||||||
|
// Enable FD in set
|
||||||
|
FD_SET(sock, &set);
|
||||||
|
|
||||||
|
// Set timeout
|
||||||
|
timeval tv;
|
||||||
|
tv.tv_sec = 0;
|
||||||
|
tv.tv_usec = timeout * 1000;
|
||||||
|
|
||||||
|
// Wait for data
|
||||||
int err = select(sock+1, &set, NULL, &set, (timeout > 0) ? &tv : NULL);
|
int err = select(sock+1, &set, NULL, &set, (timeout > 0) ? &tv : NULL);
|
||||||
if (err <= 0) { return err; }
|
if (err <= 0) { return err; }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user