summaryrefslogtreecommitdiffstats
path: root/external/optick/optick_server.h
blob: b44153e38dc6b32734855457859cc9237d2337ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include "optick.config.h"

#if USE_OPTICK
#include "optick_message.h"

#include <mutex>
#include <thread>

namespace Optick
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class Socket;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class Server
{
	InputDataStream networkStream;

	static const int BIFFER_SIZE = 1024;
	char buffer[BIFFER_SIZE];

	Socket* socket;

	std::recursive_mutex socketLock;

	Server( short port );
	~Server();

	bool InitConnection();

public:
	void Send(DataResponse::Type type, OutputDataStream& stream = OutputDataStream::Empty);
	void Update();

	string GetHostName() const;

	static Server &Get();
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

#endif //USE_OPTICK