mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-25 12:07:49 +02:00
Fixed missing library dir argument for OSX
This commit is contained in:
@ -64,6 +64,13 @@ else()
|
||||
${VOLK_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_directories(sdrpp_core PUBLIC
|
||||
${GLEW_LIBRARY_DIRS}
|
||||
${FFTW3_LIBRARY_DIRS}
|
||||
${GLFW3_LIBRARY_DIRS}
|
||||
${VOLK_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(sdrpp_core PUBLIC
|
||||
${OPENGL_LIBRARIES}
|
||||
${GLEW_LIBRARIES}
|
||||
|
2
core/src/utils/networking.cpp
Normal file
2
core/src/utils/networking.cpp
Normal file
@ -0,0 +1,2 @@
|
||||
#include <utils/networking.h>
|
||||
|
66
core/src/utils/networking.h
Normal file
66
core/src/utils/networking.h
Normal file
@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
|
||||
struct TCPAsyncRead {
|
||||
int timeout;
|
||||
int count;
|
||||
void (*handler)(int count, char* data, void* ctx);
|
||||
void* ctx;
|
||||
};
|
||||
|
||||
struct TCPAsyncWrite {
|
||||
int timeoutMs;
|
||||
int count;
|
||||
char* data;
|
||||
};
|
||||
|
||||
enum {
|
||||
NET_ERR_OK = 0,
|
||||
NET_ERR_TIMEOUT = -1,
|
||||
NET_ERR_SYSTEM = -2
|
||||
};
|
||||
|
||||
class TCPClient {
|
||||
public:
|
||||
TCPClient();
|
||||
~TCPClient();
|
||||
|
||||
bool connect(std::string host, int port);
|
||||
bool disconnect();
|
||||
|
||||
int enableAsync();
|
||||
int disableAsync();
|
||||
|
||||
bool isAsync();
|
||||
|
||||
int read(char* data, int count, int timeout = -1);
|
||||
int write(char* data, int count, int timeout = -1);
|
||||
|
||||
int asyncRead(int count, void (*handler)(int count, char* data, void* ctx), int timeout = -1);
|
||||
int asyncWrite(char* data, int count, int timeout = -1);
|
||||
|
||||
bool isOpen();
|
||||
|
||||
int close();
|
||||
|
||||
private:
|
||||
void readWorker();
|
||||
void writeWorker();
|
||||
|
||||
std::mutex readQueueMtx;
|
||||
std::vector<TCPAsyncRead> readQueue;
|
||||
|
||||
std::mutex writeQueueMtx;
|
||||
std::vector<TCPAsyncWrite> writeQueue;
|
||||
|
||||
std::thread readWorkerThread;
|
||||
std::thread writeWorkerThread;
|
||||
|
||||
bool open = false;
|
||||
bool async = false;
|
||||
|
||||
};
|
Reference in New Issue
Block a user