MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / joinServer

Method joinServer

launcher/filelink/FileLink.cpp:101–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void FileLinkApp::joinServer(QString server)
102{
103 blockSize = 0;
104
105 in.setDevice(&socket);
106
107 connect(&socket, &QLocalSocket::connected, this, [&]() { qDebug() << "connected to server"; });
108
109 connect(&socket, &QLocalSocket::readyRead, this, &FileLinkApp::readPathPairs);
110
111 connect(&socket, &QLocalSocket::errorOccurred, this, [&](QLocalSocket::LocalSocketError socketError) {
112 m_status = Failed;
113 switch (socketError) {
114 case QLocalSocket::ServerNotFoundError:
115 qDebug()
116 << ("The host was not found. Please make sure "
117 "that the server is running and that the "
118 "server name is correct.");
119 break;
120 case QLocalSocket::ConnectionRefusedError:
121 qDebug()
122 << ("The connection was refused by the peer. "
123 "Make sure the server is running, "
124 "and check that the server name "
125 "is correct.");
126 break;
127 case QLocalSocket::PeerClosedError:
128 qDebug() << ("The connection was closed by the peer. ");
129 break;
130 default:
131 qDebug() << "The following error occurred: " << socket.errorString();
132 }
133 });
134
135 connect(&socket, &QLocalSocket::disconnected, this, [&]() {
136 qDebug() << "disconnected from server, should exit";
137 m_status = Succeeded;
138 exit();
139 });
140
141 socket.connectToServer(server);
142}
143
144void FileLinkApp::runLink()
145{

Callers

nothing calls this directly

Calls 1

errorStringMethod · 0.80

Tested by

no test coverage detected