Skip to content

Commit

Permalink
[gdrbridge] Change ports and allow specifying player port
Browse files Browse the repository at this point in the history
  • Loading branch information
hgy29 committed Apr 25, 2017
1 parent c8e2ba3 commit d28c4de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion emscripten/gidshell.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</figure>
</div>
<div id="oops" class="fullscreen oops" style="display: none">
<h1>Ooops, something went wrong...</h1>
<h1>Oops, something went wrong...</h1>
<div id="memoryErr" style="display: none">
<h3>This app ran out of memory</h3>
Try to close some other apps or tabs in your browser and try again.
Expand Down
13 changes: 8 additions & 5 deletions gdrbridge/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static bool sendData(const QByteArray &out, QByteArray *in)
socket.connectToServer("gdrdeamon");
#else
QTcpSocket socket;
socket.connectToHost("127.0.0.1", 15001);
socket.connectToHost("127.0.0.1", 15011);
#endif
if (!socket.waitForConnected(1000))
return false;
Expand All @@ -42,7 +42,7 @@ static void usage()
{
fprintf(stderr, "Gideros Player Bridge v1.02\n\n");
fprintf(stderr, "usage:\n");
fprintf(stderr, "gdrbridge setip 127.0.0.1\n");
fprintf(stderr, "gdrbridge setip 127.0.0.1 [port]\n");
fprintf(stderr, "gdrbridge play mygame.gproj\n");
fprintf(stderr, "gdrbridge stop\n");
fprintf(stderr, "gdrbridge isconnected\n");
Expand All @@ -69,7 +69,7 @@ static bool isDeamonRunning()
socket.connectToServer("gdrdeamon2");
#else
QTcpSocket socket;
socket.connectToHost("127.0.0.1", 15002);
socket.connectToHost("127.0.0.1", 15012);
#endif
return socket.waitForConnected(1000);
}
Expand All @@ -79,7 +79,7 @@ static bool startDeamon(const QString &applicationDirPath)
if (isDeamonRunning())
return true;

fprintf(stderr, "* daemon not running. starting it now on port 15001 *\n");
fprintf(stderr, "* daemon not running. starting it now on port 15011 *\n");
#if defined(Q_OS_WIN)
QString program = QDir(applicationDirPath).absoluteFilePath("gdrdeamon.exe");
#else
Expand Down Expand Up @@ -148,8 +148,11 @@ int main(int argc, char *argv[])
usage();
return EXIT_FAILURE;
}
QString port="15000";
if (arguments.size() >= 4)
port= arguments[3];

outstream << QString("setip") << arguments[2];
outstream << QString("setip") << arguments[2] << port;
}
else if (arguments[1] == "isconnected")
{
Expand Down
9 changes: 5 additions & 4 deletions gdrdeamon/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ Application::Application(QObject *parent) :
server2_->listen("gdrdeamon2");
#else
server_ = new QTcpServer(this);
server_->listen(QHostAddress::Any, 15001);
server_->listen(QHostAddress::Any, 15011);

server2_ = new QTcpServer(this);
server2_->listen(QHostAddress::Any, 15002);
server2_->listen(QHostAddress::Any, 15012);
#endif
connect(server_, SIGNAL(newConnection()), this, SLOT(newConnection()));
connect(server2_, SIGNAL(newConnection()), this, SLOT(ignoreConnection()));
Expand Down Expand Up @@ -323,10 +323,11 @@ void Application::newConnection()
}
else if (command == "setip")
{
QString ip;
QString ip,port;
instream >> ip;
instream >> port;

client_->connectToHost(ip, 15000);
client_->connectToHost(ip, port.toInt());
}
else if (command == "isconnected")
{
Expand Down

0 comments on commit d28c4de

Please sign in to comment.