SearchSECODatabaseAPI
Networking.h
1/*
2This program has been developed by students from the bachelor Computer Science at
3Utrecht University within the Software Project course.
4© Copyright Utrecht University (Department of Information and Computing Sciences)
5*/
6
7#pragma once
8#include <boost/asio.hpp>
9
10using boost::asio::ip::tcp;
11
13{
14public:
15 static NetworkHandler* createHandler();
21 void sendData(const char* data, int dataSize);
22
27 void sendData(std::string data) { sendData(&(data[0]), data.length()); };
28
32 void openConnection(std::string server, std::string port);
33
41 std::string receiveData(bool stopOnNewLine = true);
42
43private:
44 boost::asio::io_context ioContext;
49 : socket(ioContext)
50 {
51 };
52
53 tcp::socket socket;
54};
Definition: Networking.h:13
void sendData(const char *data, int dataSize)
Send data to the database.
Definition: Networking.cpp:30
void sendData(std::string data)
Send data to the database.
Definition: Networking.h:27
std::string receiveData(bool stopOnNewLine=true)
Receives data from the other side of the connection.
Definition: Networking.cpp:35
void openConnection(std::string server, std::string port)
Opens a connection to the database.
Definition: Networking.cpp:15