xale-db 1.0
minimal SQL engine, written in c++
Loading...
Searching...
No Matches
WindowsSocket.h
Go to the documentation of this file.
1#if defined(_WIN32) || defined(_WIN64)
2
3#ifndef NET_WINDOWS_SOCKET_H
4#define NET_WINDOWS_SOCKET_H
5
6#include <Logger.h>
7
9
10#include <winsock2.h>
11#include <ws2tcpip.h>
12#include <string>
13
14namespace Xale::Net
15{
19 class WindowsSocket : public ISocket
20 {
21 public:
25 WindowsSocket();
26
30 ~WindowsSocket();
31
38 bool connect(const std::string& hostAddress, int port) override;
39
46 int send(const std::string* data, size_t size) override;
47
54 int receive(std::string* buffer, size_t size) override;
55
59 void close() override;
60 private:
61 Xale::Logger::Logger<WindowsSocket>& _logger;
62 SOCKET _socket;
63 sockaddr_in _address;
64 bool _wsaInitialized;
65 };
66}
67
68#endif // NET_WINDOWS_SOCKET_H
69
70#endif
Definition ISocket.h:11
Definition IPacket.h:8