#include "WinsockInterface.h"

#include "FileLogger.h"

#include <winsock2.h>
#include <ws2tcpip.h>

WinsockInterface::~WinsockInterface()
{
	closeWinsock();
}

bool WinsockInterface::initializeWinsock()
{
	WSADATA wsaData;

	auto iResult = ::WSAStartup(MAKEWORD(2, 2), &wsaData);
	if (iResult != 0) 
	{
		MLOG_ERROR("WSAStartup failed: " << iResult);
		return false;
	}
	return true;
}

void WinsockInterface::closeWinsock()
{
	::WSACleanup();
}