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
|
/*
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2014 ownCloud GmbH
* SPDX-FileCopyrightText: 2000-2013 Liferay, Inc. All rights reserved
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef COMMUNICATIONSOCKET_H
#define COMMUNICATIONSOCKET_H
#pragma once
#pragma warning (disable : 4251)
#include <string>
#include <vector>
#include <WinSock2.h>
class __declspec(dllexport) CommunicationSocket
{
public:
static std::wstring DefaultPipePath();
CommunicationSocket();
~CommunicationSocket();
bool Connect(const std::wstring& pipename);
bool Close();
bool SendMsg(const wchar_t*) const;
bool ReadLine(std::wstring*);
HANDLE Event() { return _pipe; }
private:
HANDLE _pipe;
std::vector<char> _buffer;
bool _connected = false;
};
#endif
|