47 Log::info(
"Net::Connection::connect(%s, %i)", address.c_str(), port);
53 Log::info(
"Net::Connection::connect() got empty address!");
58 ENetAddress enetAddress;
60 enet_address_set_host(&enetAddress, address.c_str());
61 enetAddress.port = port;
68 Log::info(
"Unable to initiate connection to the server.");
99 Log::warn(
"Cannot send message to not connected server!");
103 ENetPacket *packet = enet_packet_create(msg.
getData(),
105 ENET_PACKET_FLAG_RELIABLE);
bool isConnected()
Returns whether the server is connected.
void send(const ManaServ::MessageOut &msg)
Sends a message.
bool connect(const std::string &address, enet_uint16 port)
Connects to the given server with the specified address and port.
Connection(ENetHost *client)
void disconnect()
Disconnects from the given server.
Used for building an outgoing message to manaserv.
char * getData() const
Returns the content of the message.
unsigned int getDataSize() const
Returns the length of the data.
void warn(const char *log_text,...) LOG_PRINTF_ATTR
void info(const char *log_text,...) LOG_PRINTF_ATTR