expyriment.io.extras.TcpClient

class expyriment.io.extras.TcpClient(host, port, default_package_size=None, connect=None)

A class implementing a TCP network client.

__init__(host, port, default_package_size=None, connect=None)

Create a TcpClient.

clear()

Read the stream empty.

close()

Close the connection to the server.

connect()

Connect to the server.

default_package_size

Getter for default_package_size.

host

Getter for host.

is_connected

Getter for is_connected.

logging

Getter for logging.

port

Getter for port.

send(data)

Send data.

set_logging(onoff)

Set logging of this object on or off

Parameters:

onoff : bool

set logging on (True) or off (False)

Notes

See also design.experiment.set_log_level fur further information about event logging.

wait(length=None, package_size=None, duration=None, callback_function=None, process_control_events=True)

Wait for data.

Parameters:

length : int, optional

The length of the data to be waited for in bytes. If not set, a single package will be waited for.

package_size : int, optional

The size of the package to be waited for. If not set, the default package size will be used. If length < package_size, package_size = length.

duration: int, optional

The duration to wait in milliseconds.

callback_function : function, optional

function to repeatedly execute during waiting loop

process_control_events : bool, optional

process io.Keyboard.process_control_keys() and io.Mouse.process_quit_event() (default = True)

See also

design.experiment.register_wait_callback_function

Notes

This will also by default process control events (quit and pause). Thus, keyboard events will be cleared from the cue and cannot be received by a Keyboard().check() anymore!