Mesen-SX/Utilities/Socket.h
NovaSquirrel c0e249e993 Revert "Merge branch 'reformat_code'"
This reverts commit daf3b57e89, reversing
changes made to 7a6e0b7d77.
2021-03-10 11:13:28 -05:00

38 lines
661 B
C++

#pragma once
#include "stdafx.h"
class Socket
{
private:
#ifndef LIBRETRO
#ifdef _WIN32
bool _cleanupWSA = false;
#endif
uintptr_t _socket = ~0;
bool _connectionError = false;
int32_t _UPnPPort = -1;
#endif
public:
Socket();
Socket(uintptr_t socket);
~Socket();
void SetSocketOptions();
void SetConnectionErrorFlag();
void Close();
bool ConnectionError();
void Bind(uint16_t port);
bool Connect(const char* hostname, uint16_t port);
void Listen(int backlog);
shared_ptr<Socket> Accept();
int Send(char *buf, int len, int flags);
void BufferedSend(char *buf, int len);
void SendBuffer();
int Recv(char *buf, int len, int flags);
};