Code Search for Developers
 
 
  

README from Thousand Parsec at Krugle


Show README syntax highlighted

Intro
==============================================
This provides all the necessary objects to talk to the Thousand Parsec protocol. 

Support Libraries
==============================================
For basic Thousand Parsec functionality no extra Python libraries are needed. 

It is recommened to install either if you are running a server,
	python-pyopenssl
	m2crypto
or one of the following if you are running a client,
	python-pyopenssl
	m2crypto
	TLS Lite

Installing these libraries will improve SSL support.

Clients will not be able to connect to TLS enabled Thousand Parsec servers (but
it should be able to connect to SSL3 and SSL2 servers) without one of these
libraries.

Servers will not be able to serve SSL connections (or tunnel HTTPS connections)
without one of these libraries.

Library
==============================================
The library can run in either non-blocking or blocking mode.

In blocking mode operations preformed on the connection will wait for the
results to become available before returning. It will never return None.

In non-blocking mode operations preformed on the connection will return nothing.
The connection must be until the result is obtained.  It is safe to preform more
operations on the connection before the connection has returned the result, no
answer will be lost.

Poll will return None until the complete response is available. Poll will return
the answers in the same order that the actions where preformed. 

If you want to wait for an action to complete you can use wait which will wait
until the result if ready and return it. Wait will never return None.

Blocking Example Usage:

>>>
>>> import sys
>>>
>>> from tp import netlib
>>>
>>> # Create the object and connect to the server
>>> c = netlib.Connection("127.0.0.1", 6329)
>>> if not c.connect():
>>>    print "Could not connect to the server"
>>>    sys.exit(1)
>>>
>>> if not c.login("username", "password"):
>>> 	print "Could not login"
>>> 	sys.exit(1)
>>>

Non-Blocking Example Usage:

>>>
>>> import sys
>>>
>>> from tp import netlib
>>>
>>> # Create the object and connect to the server
>>> c = netlib.Connection("127.0.0.1", 6329)
>>>
>>> c.connect()
>>> c.login("username", "password")
>>>
>>> # Wait for the connection to be complete
>>> if not c.wait():
>>>    print "Could not connect to the server"
>>>    sys.exit(1)
>>>
>>> r = c.poll()
>>> while r == None:
>>> 	r = c.poll()
>>>
>>> 	# Do some other stuff!
>>> 	pass
>>>
>>> if not r:
>>> 	print "Could not login"
>>> 	sys.exit(1)
>>>
>>> # Disconnect and cleanup
>>> c.disconnect()
>>>







See more files for this project here

Thousand Parsec

Thousand Parsec is a framework for turn based 4 X\'s game (eXplore, eXpand, eXploit, eXterminate). Designed for long games, supporting massive universes and has an easily expanded tech tree.

Project homepage: http://sourceforge.net/projects/thousandparsec
Programming language(s): C++,Python
License: other

  debian/
    changelog
    compat
    control
    copyright
    rules
    watch
  tp/
    netlib/
      discover/
        pyZeroconf/
          README
          Zeroconf.py
          __init__.py
        __init__.py
        avahi_browser.py
        avahi_server.py
        bonjour_browser.py
        browse.py
        game.py
        metaserver_browser.py
        pyzeroconf_browser.py
        pyzeroconf_server.py
        server.py
      objects/
        ObjectExtra/
        OrderExtra/
        Account.py
        Base.py
        Board.py
        Board_Get.py
        Board_GetID.py
        Board_IDSequence.py
        Category.py
        Category_Add.py
        Category_Get.py
        Category_GetID.py
        Category_IDSequence.py
        Category_Remove.py
        Component.py
        Component_Get.py
        Component_GetID.py
        Component_IDSequence.py
        Connect.py
        Description.py
        Design.py
        Design_Add.py
        Design_Get.py
        Design_GetID.py
        Design_IDSequence.py
        Design_Modify.py
        Design_Remove.py
        Fail.py
        Feature.py
        Feature_Get.py
        Game.py
        Header.py
        Login.py
        Message.py
        Message_Get.py
        Message_Insert.py
        Message_Remove.py
        OK.py
        Object.py
        ObjectDesc.py
        ObjectDesc_Get.py
        Object_GetById.py
        Object_GetID.py
        Object_GetID_ByContainer.py
        Object_GetID_ByPos.py
        Object_IDSequence.py
        Order.py
        OrderDesc.py
        OrderDesc_Get.py
        OrderDesc_GetID.py
        OrderDesc_IDSequence.py
        Order_Get.py
        Order_Insert.py
        Order_Probe.py
        Order_Remove.py
        Ping.py
        Player.py
        Player_Get.py
        Property.py
        Property_Get.py
        Property_GetID.py
        Property_IDSequence.py
        Redirect.py
        Resource.py
        Resource_Get.py
        Resource_GetID.py
        Resource_IDSequence.py
        Sequence.py
        TimeRemaining.py
        TimeRemaining_Get.py
        __init__.py
        constants.py
      support/
      tests/
      GenericRS.py
      __init__.py
      client.py
      common.py
      httpdemo.py
      server.py
      twist.py
      version.py
      xstruct.py
    __init__.py
  .boring
  AUTHORS
  BUGS
  COPYING
  LICENSE
  README
  TODO
  libtpproto-py.tailor
  setup.py