Package horizons :: Package network :: Module networkinterface :: Class NetworkInterface
[hide private]
[frames] | no frames]

Class NetworkInterface

source code

Interface for low level networking

Instance Methods [hide private]
 
__init__(self) source code
 
_setup_client(self)
Initialize connection object.
source code
 
is_connected(self) source code
 
connect(self) source code
 
disconnect(self) source code
 
ping(self)
calls _connection.ping until all packets are received
source code
 
network_data_changed(self)
Call in case constants like client address or client port changed.
source code
 
_set_client_language(self) source code
 
send_packet(self, packet, *args, **kwargs) source code
 
is_joined(self) source code
 
game2mpgame(self, game) source code
 
get_game(self) source code
 
set_props(self, props) source code
 
creategame(self, mapname, maxplayers, gamename, maphash="", password="") source code
 
joingame(self, uuid, password="", fetch=False)
Join a game with a certain uuid
source code
 
_joingame(self, uuid, password="", fetch=False) source code
 
leavegame(self) source code
 
chat(self, message) source code
 
get_active_games(self)
Returns a list of active games or None on fatal error
source code
 
toggle_ready(self) source code
 
kick(self, player_sid) source code
 
get_client_name(self) source code
 
get_client_color(self) source code
 
get_clientversion(self) source code
 
change_name(self, new_name, save=True) source code
 
_on_change_name(self, game, plold, plnew, myself) source code
 
change_color(self, new_color, save=True) source code
 
_on_change_color(self, game, plold, plnew, myself) source code
 
receive_all(self)
Returns list of all packets, that have arrived until now (since the last call)
source code
 
_handle_exception(self, e) source code
 
process_async_packet(self, packet)
return True if packet was processed successfully return False if packet should be queue
source code
 
_on_game_prepare(self) source code
 
_on_game_start(self) source code
 
_on_lobbygame_starts(self, game) source code
 
_on_game_data(self, data) source code
 
_assert_connection(self) source code
 
_assert_lobby(self) source code
Class Variables [hide private]
  log = logging.getLogger("network")
  PING_INTERVAL = 0.5
Method Details [hide private]

_setup_client(self)

source code 

Initialize connection object. Does not connect to the server.

is_connected(self)

source code 
Decorators:
  • @property

network_data_changed(self)

source code 

Call in case constants like client address or client port changed.

@throws RuntimeError in case of invalid data or an NetworkException forwarded from connect

is_joined(self)

source code 
Decorators:
  • @property

receive_all(self)

source code 

Returns list of all packets, that have arrived until now (since the last call)

Returns:
list of packets