What am I doing wrong?
This commit is contained in:
@@ -1,22 +1,34 @@
|
||||
#include "tcp_network_manager.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
TCPNetworkManager::TCPNetworkManager() {
|
||||
maxConnections = currentConnections = 0;
|
||||
//
|
||||
}
|
||||
|
||||
TCPNetworkManager::~TCPNetworkManager() {
|
||||
//
|
||||
}
|
||||
|
||||
void TCPNetworkManager::Init(int maxConnections) {
|
||||
//
|
||||
void TCPNetworkManager::Init(Uint16 port, int maxSockets) {
|
||||
IPaddress add;
|
||||
if (SDLNet_ResolveHost(&add, nullptr, port)) {
|
||||
throw(std::runtime_error("Failed to resolve the host"));
|
||||
}
|
||||
if (!(sock = SDLNet_TCP_Open(&add))) {
|
||||
throw(std::runtime_error("Failed to create the server socket"));
|
||||
}
|
||||
if (!(clientSocks = SDLNet_AllocSocketSet(maxSockets))) {
|
||||
throw(std::runtime_error("Failed to allocate the socket set"));
|
||||
}
|
||||
}
|
||||
|
||||
void TCPNetworkManager::Quit() {
|
||||
//
|
||||
SDLNet_FreeSocketSet(clientSocks);
|
||||
SDLNet_TCP_Close(sock);
|
||||
}
|
||||
|
||||
int TCPNetworkManager::AcceptConnection() {
|
||||
int TCPNetworkManager::AcceptConnections() {
|
||||
//
|
||||
}
|
||||
|
||||
@@ -44,10 +56,10 @@ int TCPNetworkManager::CloseSocket(int index) {
|
||||
//
|
||||
}
|
||||
|
||||
int TCPNetworkManager::GetMaxConnections() {
|
||||
int TCPNetworkManager::GetMaxConnections() const {
|
||||
//
|
||||
}
|
||||
|
||||
int TCPNetworkManager::GetCurrentConnections() {
|
||||
int TCPNetworkManager::GetCurrentConnections() const {
|
||||
//
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user