GObj GConnex

GObj for manage socket connection handshake.

class ginsfsm.c_connex.GConnex[source]

GConnex gobj. Responsible for maintaining the client socket connected, or not. It can maintain the connection closed, until new data arrived. It can have several destinations to connect.

Configurable Parameters:
Name Type Default value Description
rx_data_event_name str EV_RX_DATA Name of the rx_data event. None if you want ignore the event
disabled bool False Set True to disabled the connection
host str ONLY READ!! server or client host (ip or name)
disconnected_event_name str EV_DISCONNECTED Name of the disconnected event. None if you want ignore the event
port int 0 ONLY READ!! server or client port
connected_event_name str EV_CONNECTED Name of the connected event. None if you want ignore the event
destinations list [(‘’, 0)] list of destination (host,port) tuples.
timeout_inactivity int -1 Inactivity timeout to close the connection.Reconnect when new data arrived. With -1 never close.
timeout_between_connections int 5 Idle timeout to wait between attempts of connection.
subscriber None None subcriber of all output-events.Default is None, i.e., the parent
timeout_waiting_connected int 60
transmit_ready_event_name str EV_TRANSMIT_READY Name of the transmit_ready event. None if you want ignore the event
  • 'EV_SEND_DATA': transmit

    Mandatory attributes of the received event:

    • data: data to send.
  • 'EV_CONNECTED': socket connected.

    Attributes added to the sent event:

    • peername: remote address to which the socket is connected.
    • sockname: the socket’s own address.
  • 'EV_DISCONNECTED': socket disconnected.

  • 'EV_TRANSMIT_READY': socket ready to transmit more data.

  • 'EV_RX_DATA': data received. Attributes added to the sent event:

    • data: Data received from remote address.

Return the destination (host,port) tuple to connect from the destinations attribute. If there are multiple tuples in destinations attribute, try to connect to each tuple cyclically. Override ginsfsm.c_sock.GSock.get_next_dst().


Initialization zone.

Subcribe all enabled output-event’s to subscriber with this sentence:

self.subscribe_event(None, self.subscriber)