hio.core.tcp.clienting

hio.core.tcp.clienting Module

Module Contents

Classes

Client

Nonblocking TCP Socket Client Class.

ClientTls

Outgoer with Nonblocking TLS/SSL support

ClientDoer

Basic TCP Client

Functions

openClient(cls=None, **kwa)

Wrapper to create and open TCP Client instances

Attributes

logger

hio.core.tcp.clienting.logger[source]
hio.core.tcp.clienting.openClient(cls=None, **kwa)[source]

Wrapper to create and open TCP Client instances When used in with statement block, calls .close() on exit of with block

Parameters

instance (cls is Class instance of subclass) –

Usage:
with openClient() as client0:

client0.accept()

with openClient(cls=ClientTls) as client0:

client0.accept()

class hio.core.tcp.clienting.Client(tymeout=None, ha=None, host='127.0.0.1', port=56000, reconnectable=None, bs=8096, txbs=None, rxbs=None, wl=None, **kwa)[source]

Bases: hio.base.tyming.Tymee

Nonblocking TCP Socket Client Class.

See tyming.Tymee for inherited attributes, properties, and methods

Attributes:

Properties:

Methods:

Tymeout = 0.0[source]
Reconnectable = False[source]
property host(self)[source]

Property that returns host in .ha duple

property port(self)[source]

Property that returns port in .ha duple

property accepted(self)[source]

Property that returns accepted state of TCP socket

property connected(self)[source]

Property that returns connected state of TCP socket Non-tls tcp is connected when accepted

wind(self, tymth)[source]

Inject new tymist.tymth as new ._tymth. Changes tymist.tyme base. Updates winds .tymer .tymth

reinitHostPort(self, ha=None, hostname='127.0.0.1', port=56000)[source]

Reinit self.ha and self.hostname from ha = (host, port) or hostname port self.ha is of form (host, port) where host is either dns name or ip address self.hostname is hostname as dns name host eventually is host ip address output from normalizeHost()

actualBufSizes(self)[source]

Returns duple of the the actual socket send and receive buffer size (send, receive)

open(self)[source]

Opens connection socket in non blocking mode.

if socket not closed properly, binding socket gets error

OSError: (48, ‘Address already in use’)

reopen(self)[source]

Idempotently opens socket

shutdown(self, how=socket.SHUT_RDWR)[source]

Shutdown connected socket .cs

shutdownSend(self)[source]

Shutdown send on connected socket .cs

shutdownReceive(self)[source]

Shutdown receive on connected socket .cs

close(self)[source]

Shutdown and close connected socket .cs

refresh(self)[source]

Restart timer

accept(self)[source]

Attempt nonblocking acceptance connect to .ha Returns True if successful Returns False if not so try again later

connect(self)[source]

Attempt nonblocking connect to .ha Returns True if successful Returns False if not so try again later For non-TLS tcp connect is done when accepted This is placeholder for subclass Tls

serviceConnect(self)[source]

Service connection attempt If not already connected make a nonblocking attempt Returns .connected

receive(self)[source]

Perform non blocking receive from connected socket .cs

If no data then returns None If connection closed then returns empty Otherwise returns data data is string in python2 and bytes in python3

serviceReceives(self)[source]

Service receives until no more

serviceReceiveOnce(self)[source]

Retrieve from server only one reception

clearRxbs(self)[source]

Clear .rxbs

send(self, data)[source]

Perform non blocking send on connected socket .cs. Return number of bytes sent data is string in python2 and bytes in python3

tx(self, data)[source]

Copy data onto .txbs, .extend copies data.

serviceSends(self)[source]

Service sends (transmits) of data in .txbs bytearray Attempt to send all of .txbs. Delete what is actually sent.

service(self)[source]

Service connect, txbs, and receives.

class hio.core.tcp.clienting.ClientTls(context=None, version=None, certify=None, hostify=None, certedhost='', keypath=None, certpath=None, cafilepath=None, **kwa)[source]

Bases: Client

Outgoer with Nonblocking TLS/SSL support Nonblocking TCP Socket Client Class.

Attributes:

Properties:

Methods:

property connected(self)[source]

Property that returns connected state of TCP socket TLS tcp is connected when accepted and handshake completed

close(self)[source]

Shutdown and close connected socket .cs

wrap(self)[source]

Wrap socket .cs in ssl context

handshake(self)[source]

Attempt nonblocking ssl handshake to .ha Returns True if successful Returns False if not so try again later

connect(self)[source]

Attempt nonblocking connect to .ha Returns True if successful Returns False if not so try again later Connected when both accepted connection and TLS handshake complete

receive(self)[source]

Perform non blocking receive from connected socket .cs

If no data then returns None If connection closed then returns ‘’ Otherwise returns data data is string in python2 and bytes in python3

send(self, data)[source]

Perform non blocking send on connected socket .cs. Return number of bytes sent data is string in python2 and bytes in python3

class hio.core.tcp.clienting.ClientDoer(client, **kwa)[source]

Bases: hio.base.doing.Doer

Basic TCP Client

See Doer for inherited attributes, properties, and methods.

.client is TCP Client instance
wind(self, tymth)[source]

Inject new tymist.tymth as new ._tymth. Changes tymist.tyme base. Updates winds .tymer .tymth

enter(self)[source]
recur(self, tyme)[source]
exit(self)[source]