[tuxdroid-svn] r5371 - software_suite_v3/smart-core/smart-api/python/branches/user_mode/tuxisalive/
Status: Beta
Brought to you by:
ks156
|
From: ks156 <c2m...@c2...> - 2009-09-14 10:24:39
|
Author: ks156
Date: 2009-09-14 12:24:25 +0200 (Mon, 14 Sep 2009)
New Revision: 5371
Modified:
software_suite_v3/smart-core/smart-api/python/branches/user_mode/tuxisalive/api/sh.py
Log:
* Changed the way to connect the API to automatically determine which port
must be used.
Modified: software_suite_v3/smart-core/smart-api/python/branches/user_mode/tuxisalive/api/sh.py
===================================================================
--- software_suite_v3/smart-core/smart-api/python/branches/user_mode/tuxisalive/api/sh.py 2009-09-14 10:22:24 UTC (rev 5370)
+++ software_suite_v3/smart-core/smart-api/python/branches/user_mode/tuxisalive/api/sh.py 2009-09-14 10:24:25 UTC (rev 5371)
@@ -7,6 +7,7 @@
"Free" client mode.
"""
import os
+import time
if os.name == 'nt':
from version import author, date, version, licence
else:
@@ -35,7 +36,13 @@
global tux
+# Try to connect to the port 270
tux = TuxAPI("127.0.0.1", 270)
+time.sleep(1)
+# If the API is not connected to the port 270, then try the port 54321 (user
+# mode)
+if not tux.server.getConnected():
+ tux = TuxAPI("127.0.0.1", 54321)
verString = tux.getVersion()
verH = "".join("=" * len(verString))
|