[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdegames
From: Wolfgang Rohdewald <wolfgang () rohdewald ! de>
Date: 2012-03-09 10:46:52
Message-ID: 20120309104652.E0203AC899 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1284574 by wrohdewald:
make server and client derive the default port from the version number
M +8 -2 doc/kajongg/index.docbook
M +6 -0 kajongg/src/common.py
M +1 -1 kajongg/src/config.py
M +4 -2 kajongg/src/server.py
--- trunk/KDE/kdegames/doc/kajongg/index.docbook #1284573:1284574
@@ -284,13 +284,19 @@
</para></listitem><listitem><para>
manually start a server on any computer you want. All you need to do is go to a command \
line and start the program "kajonggserver". Entering "kajonggserver --help"
- will show you all available options like changing the default port 8149. This server will \
run until you kill it. + will show you all available options like changing the default port. \
This server will run until you kill it. </para></listitem></itemizedlist>
</para><para>
In both cases you need to tell the other players how they can reach your game server. They \
need the &URL; or simply an IP address and the port your server is
- listening on. This might be something like "mypc.dyndns.org:8149" where 8149 is the port. Of \
course you need to configure your firewall such that the remote + listening on. This might be \
something like "mypc.dyndns.org:8409" where 8409 is the port. Of course you need to configure your \
firewall such that the remote
player can reach that port. The communication will be encrypted.
</para><para>
+ The server computes its default port from its version number.
+ If &kajongg; has version 4.9.5, port 8409 will be used: 8000 plus first version digit * 100 plus \
middle version digit. + If the player enters no port for the wanted game server, the client computes \
the port in the same way. + So if a computer runs several game servers with different program \
versions, you should normally reach the correct game server automatically. + Anyway the game server \
and the client will make sure that their versions are compatible and warn you otherwise. + \
</para><para> If you encounter possible bugs, you might want to use the option "--showtraffic". This \
will show you, on the console where the game server has been started,
what messages are flowing between the game server and the clients.
</para>
--- trunk/KDE/kdegames/kajongg/src/common.py #1284573:1284574
@@ -106,6 +106,12 @@
def __init__(self):
raise Exception('InternalParameters is not meant to be instantiated')
+ @staticmethod
+ def defaultPort():
+ """8000 plus version: for version 4.9.5 we use 8409"""
+ parts = InternalParameters.version.split('.')
+ return 8000 + int(parts[0]) * 100 + int(parts[1])
+
class IntDict(defaultdict):
"""a dict where the values are expected to be numeric, so
we can add dicts.If parent is given, parent is expected to
--- trunk/KDE/kdegames/kajongg/src/config.py #1284573:1284574
@@ -98,7 +98,7 @@
self.addString('General', 'tilesetName', 'default')
self.addString('General', 'windTilesetName', 'traditional')
self.addString('General', 'backgroundName', 'wood_light')
- self.addInteger('Network', 'serverPort', 8149)
+ self.addInteger('Network', 'serverPort', 8490)
self.addBool('Display', 'showShadows', True)
self.addBool('Display', 'rearrangeMelds', False)
self.addBool('Display', 'showOnlyPossibleActions', True)
--- trunk/KDE/kdegames/kajongg/src/server.py #1284573:1284574
@@ -1014,8 +1014,10 @@
"""start the server"""
from optparse import OptionParser
parser = OptionParser()
- parser.add_option('', '--port', dest='port', help=m18n('the server will listen on PORT'),
- type=int, default=8149)
+ defaultPort = InternalParameters.defaultPort()
+ parser.add_option('', '--port', dest='port',
+ help=m18n('the server will listen on PORT (%d)' % defaultPort),
+ type=int, default=defaultPort)
parser.add_option('', '--socket', dest='socket',
help=m18n('the server will listen on SOCKET'), default=None)
parser.add_option('', '--db', dest='dbpath', help=m18n('name of the database'), default=None)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic