new socket for slsDetector

This commit is contained in:
Erik Frojdh
2019-01-25 16:44:29 +01:00
parent a1c0d28ddb
commit 89ee1d5bcf
19 changed files with 1341 additions and 1283 deletions

View File

@@ -1,27 +1,32 @@
#pragma once
#include <cstdint>
#include <cstddef>
#include <cstdint>
#include <netdb.h>
namespace sls {
class DataSocket {
public:
DataSocket(int socketId);
DataSocket(DataSocket&& move) noexcept;
DataSocket& operator=(DataSocket&& move) noexcept;
void swap(DataSocket& other) noexcept;
DataSocket(DataSocket const&) = delete;
DataSocket& operator=(DataSocket const&) = delete;
int getSocketId() const{
DataSocket(DataSocket &&move) noexcept;
virtual ~DataSocket();
DataSocket &operator=(DataSocket &&move) noexcept;
void swap(DataSocket &other) noexcept;
DataSocket(DataSocket const &) = delete;
DataSocket &operator=(DataSocket const &) = delete;
int getSocketId() const {
return socketId_;
}
size_t sendData(char *buffer, size_t size);
size_t receiveData(char * buffer, size_t size);
size_t sendData(void *buffer, size_t size);
size_t receiveData(void *buffer, size_t size);
int setTimeOut(int t_seconds);
void close();
private:
int socketId_ = -1;
};
int ConvertHostnameToInternetAddress(const char *const hostname, struct ::addrinfo **res);
int ConvertInternetAddresstoIpString(struct ::addrinfo *res, char *ip, const int ipsize);
}; // namespace sls