fixes
This commit is contained in:
parent
64739c39d8
commit
9bdf133d0f
12 changed files with 301 additions and 168 deletions
|
|
@ -22,12 +22,21 @@ export module Crafter.Network:ClientTCP;
|
|||
import std;
|
||||
|
||||
namespace Crafter {
|
||||
export class SocketClosedException : public std::exception {
|
||||
public:
|
||||
const char* what() const noexcept override {
|
||||
return "Socket closed";
|
||||
}
|
||||
};
|
||||
|
||||
export class ClientTCP {
|
||||
public:
|
||||
int socketid;
|
||||
ClientTCP(int socket);
|
||||
ClientTCP(const char* host, std::uint16_t port);
|
||||
ClientTCP(std::string host, std::uint16_t port);
|
||||
~ClientTCP();
|
||||
void Stop();
|
||||
void Send(const void* buffer, std::uint32_t size) const;
|
||||
std::vector<char> RecieveSync() const;
|
||||
std::vector<char> RecieveUntilCloseSync() const;
|
||||
|
|
@ -39,7 +48,5 @@ namespace Crafter {
|
|||
void RecieveAsync(std::uint32_t bufferSize, std::function<void(std::vector<char>)> recieveCallback) const;
|
||||
void RecieveUntilFullAsync(std::uint32_t bufferSize, std::function<void(std::vector<char>)> recieveCallback) const;
|
||||
void RecieveAsync(std::uint32_t bufferSize, std::function<void(int)> recieveCallback, char* buffer) const;
|
||||
private:
|
||||
int socketid;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue