1
0

ProtoProxy: ListenPort and ConnectPort are now settable on commandline, the defaults have switched (listens on 25564, connects to localhost:25565)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@992 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-10-20 21:52:34 +00:00
parent 12edc53ab5
commit 3ac98f3f26
2 changed files with 6 additions and 1 deletions

View File

@ -12,8 +12,10 @@
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
int ListenPort = (argc > 1) ? atoi(argv[1]) : 25564;
int ConnectPort = (argc > 2) ? atoi(argv[2]) : 25565;
cServer Server; cServer Server;
int res = Server.Init(25565, 25564); int res = Server.Init(ListenPort, ConnectPort);
if (res != 0) if (res != 0)
{ {
printf("Server initialization failed: %d", res); printf("Server initialization failed: %d", res);

View File

@ -46,6 +46,9 @@ int cServer::Init(short a_ListenPort, short a_ConnectPort)
local.sin_port = htons(a_ListenPort); local.sin_port = htons(a_ListenPort);
bind(m_ListenSocket, (sockaddr *)&local, sizeof(local)); bind(m_ListenSocket, (sockaddr *)&local, sizeof(local));
listen(m_ListenSocket, 1); listen(m_ListenSocket, 1);
printf("Listening on port %d, connecting to localhost:%d\n", a_ListenPort, a_ConnectPort);
return 0; return 0;
} }