MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / connect

Method connect

source/network/ODClient.cpp:1019–1039  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1017}
1018
1019bool ODClient::connect(const std::string& host, const int port, uint32_t timeout, const std::string& outputReplayFilename)
1020{
1021 mIsPlayerConfig = false;
1022 // Start the server socket listener as well as the server socket thread
1023 if (ODClient::getSingleton().isConnected())
1024 {
1025 OD_LOG_INF("Couldn't try to connect: The client is already connected");
1026 return false;
1027 }
1028
1029 if(!ODSocketClient::connect(host, port, timeout, outputReplayFilename))
1030 return false;
1031
1032 // Send a hello request to start the conversation with the server
1033 ODPacket packSend;
1034 packSend << ClientNotificationType::hello
1035 << std::string("OpenDungeons V ") + ODApplication::VERSION;
1036 send(packSend);
1037
1038 return true;
1039}
1040
1041bool ODClient::replay(const std::string& filename)
1042{

Calls 1

isConnectedMethod · 0.45

Tested by

no test coverage detected