HSL 2.0 framework Description of the framework

Public Member Functions |List of all members
hsl20_4_tcp.hsl20_4_tcp.Client Class Reference

All methods of the TCP client More..

## Public Member Functions
def | __init__ (self, framework, context_map)
| Constructor. More...
def | set_address (self, ip, port)
| Sets the destination address. More...
def | set_on_connect (self, callback)
| Sets a callback method. More...
def | set_on_data (self, callback)
| Sets a callback method. More...
def | set_on_error (self, callback)
| Sets the callback method. More...
def | set_on_close (self, callback)
| Sets the callback method. More...
def | connect (self)
| Attempts to establish a connection to the configured remote party. More...
def | close (self)
| Closes the current connection. More...
def | send (self, data)
| Sends data to the remote party. More...

## Detailed Description

All methods of the TCP client

Deprecated:
  This class should no longer be used

Used to communicate with a remote party via TCP/IP

Note
  The class works asynchronously. None of the methods offered are blocked. Class is deprecated

## Constructor & Destructor Documentation

## ◆ __init__()

def hsl20_4_tcp.hsl20_4_tcp.Client.__init__ | ( |  | self,
|  |  | framework,
|  |  | context_map
| ) |  |

Constructor

Warning
  This class should not be instantiated directly

## Member Function Documentation

## ◆ close()

def hsl20_4_tcp.hsl20_4_tcp.Client.close | ( |  | self | ) |

Closes the current connection

## ◆ connect()

def hsl20_4_tcp.hsl20_4_tcp.client.connect | ( |  | self | ) |

Attempts to establish a connection to the configured remote party

Exceptions

  AttributeError | Is triggered if no IP address or port has been defined yet
  RuntimeError | If this method is called while the client is already connected, a RuntimeError exception is thrown

## ◆ send()

def hsl20_4_tcp.hsl20_4_tcp.client.send | ( |  | self,
|  |  | data
| ) |  |

Sends data to the remote party

Parameters

  data | string Data to be sent

## ◆ set_address()

def hsl20_4_tcp.hsl20_4_tcp.Client.set_address | ( |  | self,
|  |  | ip,
|  |  | port
| ) |  |

Sets the destination address

Parameters

  ip | string IP address or hostname
  port | int IP port

Exceptions

  RuntimeError | If this method is called while the client is already connected, a RuntimeError exception is thrown

## ◆ set_on_close()

def hsl20_4_tcp.hsl20_4_tcp.Client.set_on_close | ( |  | self,
|  |  | callback
| ) |  |

Sets the callback method

The method is called when the connection (from the remote party) is closed.

No parameters are transferred to the callback.

Parameters

  callback | function Callback method

## ◆ set_on_connect()

def hsl20_4_tcp.hsl20_4_tcp.Client.set_on_connect | ( |  | self,
|  |  | callback
| ) |  |

Sets a callback method

The method is called when a connection to the remote party is established.

No parameters are passed to the callback.

Parameters

  callback | function Callback method

## ◆ set_on_data()

def hsl20_4_tcp.hsl20_4_tcp.Client.set_on_data | ( |  | self,
|  |  | callback
| ) |  |

Sets a callback method

The method is called when a TCP/IP message is received.

Parameters

  callback | function Callback method data string Data

## ◆ set_on_error()

def hsl20_4_tcp.hsl20_4_tcp.Client.set_on_error | ( |  | self,
|  |  | callback
| ) |  |

Sets the callback method

The method is called if an error has occurred in the communication.

Parameters for callback:

- exception Exception
  The Exception Object

Parameters

  callback | function callback method

The documentation for this class was generated from the following file:

- hsl20_4_tcp.py