xale-db 1.0
minimal SQL engine, written in c++
Loading...
Searching...
No Matches
LinuxSocket.h
Go to the documentation of this file.
1#if defined(__linux__) || defined(linux) || defined(__GNUG__)
2
3#ifndef NET_LINUX_SOCKET_H
4#define NET_LINUX_SOCKET_H
5
6#include <Logger.h>
7
9
10#include <sys/socket.h>
11#include <netinet/in.h>
12#include <arpa/inet.h>
13#include <unistd.h>
14#include <cstring>
15#include <string>
16
17namespace Xale::Net
18{
22 class LinuxSocket : public ISocket
23 {
24 public:
28 LinuxSocket();
29
35 bool connect(const std::string& hostAddress, int port) override;
36
42 int send(const std::vector<uint8_t>* data, size_t size) override;
43
49 int receive(std::vector<uint8_t>* buffer, size_t size) override;
50
54 void close() override;
55 private:
56 Xale::Logger::Logger<LinuxSocket>& _logger;
57 int _socket;
58 sockaddr_in _address;
59 };
60}
61
62#endif // NET_LINUX_SOCKET_H
63
64#endif
Definition ISocket.h:11
Definition IPacket.h:8