Fixed RTL-TCP bug

This commit is contained in:
Ryzerth
2021-07-21 16:23:03 +02:00
parent a974658c98
commit 2baf607b8c
2 changed files with 35 additions and 10 deletions

View File

@@ -137,11 +137,17 @@ public:
}
void receiveData(uint8_t* buf, size_t count) {
int received = 0;
int ret = 0;
while (received < count) {
#ifdef _WIN32
recv(sock, (char*)buf, count, 0);
ret = recv(sock, (char*)&buf[received], count - received, 0);
#else
(void)read(sockfd, buf, count);
ret = read(sockfd, &buf[received], count - received);
#endif
if (ret <= 0) { return; }
received += ret;
}
}
void setFrequency(double freq) {
@@ -168,6 +174,10 @@ public:
sendCommand(9, mode);
}
void setOffsetTuning(bool enabled) {
sendCommand(10, enabled);
}
void setGainIndex(int index) {
sendCommand(13, index);
}