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{
16 class WindowsSocket : public ISocket
17 {
18 public:
19 WindowsSocket();
20 ~WindowsSocket();
21 bool connect(const std::string& hostAddress, int port) override;
22 int send(const std::string* data, size_t size) override;
23 int receive(std::string* buffer, size_t size) override;
24 void close() override;
25 private:
26 Xale::Logger::Logger<WindowsSocket>& _logger;
27 SOCKET _socket;
28 sockaddr_in _address;
29 bool _wsaInitialized;
30 };
31}
32
33#endif // NET_WINDOWS_SOCKET_H
34
35#endif
Definition ISocket.h:9
Definition IListenerSocket.h:7