final app

This commit is contained in:
2020-01-11 07:05:54 +01:00
parent dcfb945c0b
commit 31fe531703
68 changed files with 62242 additions and 129 deletions

View File

@@ -1,6 +1,6 @@
#pragma once
#include <WinSock2.h>
#include <vector>
#include "ipVersion.h"
#include "Protocol.h"
#include "Result.h"
@@ -14,16 +14,22 @@ namespace SocketLibrary
public:
Socket(IPVersion ipversion = IPVersion::IPv4, Protocol protocol = Protocol::TCP, SOCKET socket = INVALID_SOCKET); //(..., SocketHandle handle)
Socket(Protocol protocol);
Socket(SOCKET socket);
Result Create();
Result Close();
Result AssignEndpoint(Endpoint endpoint);
Result Bind(Endpoint endpoint);
Result BindAndListen(Endpoint endpoint, int waitConnection = 5);
Result Accpet(Socket& outSocket);
Result Accept(Socket& outSocket);
Result Connect();
Result Connect(Endpoint endpoint);
Result SendUDP(std::string& listOfUsers, Endpoint server);
Result ReciveUDP(std::string& output, int& numberOfBytes);
Result SendAll(const void * data, int numberOfBytes);
Result ReciveAll(std::string& output, int& numberOfBytes);
SOCKET GetSocket(); //SocketHandle GetHandle()
IPVersion GetIpVersion();
Endpoint GetEndpoint();
private:
Result Send(const void * data, int size, int& bytesSent);
Result Recive(void * buffor, int size, int & bytesRecived);
@@ -31,6 +37,7 @@ namespace SocketLibrary
IPVersion _ipversion = IPVersion::IPv4;
Protocol _protocol = Protocol::TCP;
SOCKET _socket = INVALID_SOCKET;
Endpoint _endpoint = {};
};
}