mxcubecore.Command.exporter.StandardClient#

ProtocolError and StandardClient implementation

Functions

empty_buffer()

Empty buffer

Classes

PROTOCOL()

Protocol

StandardClient(server_ip, server_port, ...)

Standard JLib client

Exceptions

ProtocolError

Protype

SocketError

Protype

TimeoutError

Protype

class mxcubecore.Command.exporter.StandardClient.PROTOCOL[source]#

Bases: object

Protocol

exception mxcubecore.Command.exporter.StandardClient.ProtocolError[source]#

Bases: Exception

Protype

exception mxcubecore.Command.exporter.StandardClient.SocketError[source]#

Bases: Exception

Protype

class mxcubecore.Command.exporter.StandardClient.StandardClient(server_ip, server_port, protocol, timeout, retries)[source]#

Bases: object

Standard JLib client

connect()[source]#

Socket connect

disconnect()[source]#

Disconnect

dispose()[source]#

Disconnect or close socket

is_connected()[source]#

Check if connected :returns: True if connected :rtype: (bool)

on_connected()[source]#

On connect

on_disconnected()[source]#

On disconnect

on_message_received(msg)[source]#

Actions :param msg: Message :type msg: str

recv_thread()[source]#

Receive thread

restore_timeout()[source]#

Restore the default timeout

send(cmd)[source]#

Send command. :param cmd: command :type cmd: str

Returns:

reply form the socket

Return type:

(str)

Raises:

ProtocolError

send_receive(cmd, timeout=-1)[source]#

Send/receive command, locking the socket. :param cmd: command :type cmd: str

Returns:

reply form the socket

Return type:

(str)

set_timeout(timeout)[source]#

Set the socket timeout. :param timeout: Timeout value :type timeout: float

exception mxcubecore.Command.exporter.StandardClient.TimeoutError[source]#

Bases: Exception

Protype

mxcubecore.Command.exporter.StandardClient.empty_buffer()[source]#

Empty buffer

mxcubecore.Command.exporter.StandardClient.encode(self, /, encoding='utf-8', errors='strict')#

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.