Infinity.SimulatedConnection

g GObject.GInterface GObject.GInterface Infinity.XmlConnection Infinity.XmlConnection GObject.GInterface->Infinity.XmlConnection GObject.Object GObject.Object Infinity.SimulatedConnection Infinity.SimulatedConnection GObject.Object->Infinity.SimulatedConnection Infinity.XmlConnection->Infinity.SimulatedConnection

Subclasses:None

Methods

Inherited:GObject.Object (37), Infinity.XmlConnection (6)
Structs:GObject.ObjectClass (5)
class new ()
class new_with_io (io)
  connect (to)
  flush ()
  set_mode (mode)

Properties

Inherited:Infinity.XmlConnection (6)
Name Type Flags Short Description
io Infinity.Io r/w/co The main loop to be used for IO_CONTROLLED mode
mode Infinity.SimulatedConnectionMode r/w/c The mode of the simulated connection
target Infinity.SimulatedConnection r/w The simulated connection receiving data sent through this connection

Fields

Inherited:GObject.Object (1), Infinity.XmlConnection (3)
Name Type Access Description
parent GObject.Object r  

Class Details

class Infinity.SimulatedConnection(**kwargs)
Bases:GObject.Object, Infinity.XmlConnection
Abstract:No
Structure:Infinity.SimulatedConnectionClass

Infinity.SimulatedConnection is an opaque data type. You should only access it via the public API functions.

classmethod new()
Returns:A new Infinity.SimulatedConnection.
Return type:Infinity.SimulatedConnection

Creates a new Infinity.SimulatedConnection. A connection created this way cannot be switched to Infinity.SimulatedConnectionMode.IO_CONTROLLED mode. Use Infinity.SimulatedConnection.new_with_io() instead if you intend to do that.

classmethod new_with_io(io)
Parameters:io (Infinity.Io) – The main loop to be used for Infinity.SimulatedConnectionMode.IO_CONTROLLED mode.
Returns:A new Infinity.SimulatedConnection.
Return type:Infinity.SimulatedConnection

Creates a new Infinity.SimulatedConnection with the given Infinity.Io. This connection can be used with Infinity.SimulatedConnectionMode.IO_CONTROLLED mode. If you don’t intend to use that mode then using Infinity.SimulatedConnection.new() is also good enough since the Infinity.Io object is not required in that case.

connect(to)
Parameters:to (Infinity.SimulatedConnection) – The target connection.

Connects two simulated connections, so that data sent through one of them is received by the other one and vice versa. So one call to this function connects both Infinity.SimulatedConnection s to each other. There is no need to call this function once for each connection.

If one or both of the connections already have another target, then the simulated connection between those is closed first.

flush()

When self’s mode is Infinity.SimulatedConnectionMode.DELAYED or Infinity.SimulatedConnectionMode.IO_CONTROLLED, then calling this function makes the target connection receive all the queued messages.

set_mode(mode)
Parameters:mode (Infinity.SimulatedConnectionMode) – The new mode to set.

Sets the mode of the simulated connection.

In Infinity.SimulatedConnectionMode.IMMEDIATE mode, messages sent through the connection are received by the target during the call to Infinity.XmlConnection.send().

In Infinity.SimulatedConnectionMode.DELAYED mode, messages sent are queued and received by the target when Infinity.SimulatedConnection.flush() is called.

In Infinity.SimulatedConnectionMode.IO_CONTROLLED mode, messages are queued and received by the target as soon as a dispatch handler (see Infinity.Io.add_dispatch()) installed on the main loop is called.

When changing the mode from Infinity.SimulatedConnectionMode.DELAYED or Infinity.SimulatedConnectionMode.IO_CONTROLLED to Infinity.SimulatedConnectionMode.IMMEDIATE, then the queue is flushed, too.

Property Details

Infinity.SimulatedConnection.props.io
Name:io
Type:Infinity.Io
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The main loop to be used for IO_CONTROLLED mode

Infinity.SimulatedConnection.props.mode
Name:mode
Type:Infinity.SimulatedConnectionMode
Default Value:Infinity.SimulatedConnectionMode.IMMEDIATE
Flags:READABLE, WRITABLE, CONSTRUCT

The mode of the simulated connection

Infinity.SimulatedConnection.props.target
Name:target
Type:Infinity.SimulatedConnection
Default Value:None
Flags:READABLE, WRITABLE

The simulated connection receiving data sent through this connection