xale-db 1.0
minimal SQL engine, written in c++
Loading...
Searching...
No Matches
TcpClient.h
Go to the documentation of this file.
1#ifndef NET_TCP_CLIENT_H
2#define NET_TCP_CLIENT_H
3
5
6#include <string>
7#include <memory>
8
9namespace Xale::Net
10{
12 {
13 public:
14 TcpClient();
15 ~TcpClient();
16 bool connect(const std::string& ip, int port);
17 int send(const std::string* data, size_t size); // should be SecurePaquet in the future
18 int receive(std::string* buffer, size_t size);
19 void close();
20 private:
21 std::unique_ptr<Xale::Net::ISocket> _socket;
22
23 };
24}
25
26#endif // NET_TCP_CLIENT_H
~TcpClient()
Destructor.
Definition TcpClient.cpp:15
int receive(std::string *buffer, size_t size)
Receives data from the server.
Definition TcpClient.cpp:48
TcpClient()
Constructor.
Definition TcpClient.cpp:8
bool connect(const std::string &ip, int port)
Connects to the server at the specified IP and port.
Definition TcpClient.cpp:23
void close()
Closes the connection.
Definition TcpClient.cpp:59
int send(const std::string *data, size_t size)
Sends data to the server.
Definition TcpClient.cpp:37
Definition IListenerSocket.h:7