IPWorks IPC 2020 Python Edition

Questions / Feedback?

PipeClient Class

Properties   Methods   Events   Configuration Settings   Errors  

The PipeClient class is a simple client for connecting and communicating over named pipes.

Syntax

class ipworksipc.PipeClient

Remarks

The PipeClient class is used to connect to an existing pipe server. After connecting the transfer of data is handled very similarly to socket communication.

To begin, first set pipe_name to the name of the pipe to which the connection will be made. Call connect or set on_connected to True to establish the connection. The on_connected event will fire when the connection is complete.

After connecting set data_to_send, or call send or send_file to send data. Incoming data is received through the on_data_in event.

To disconnect call disconnect or set connected to False.

Synchronous and Asynchronous Operation

If the timeout property is set to 0, the class will behave asynchronously and all operations return immediately, potentially failing with an error if they can't be completed immediately.

If timeout is set to a positive value, the class will behave synchronously and wait for the operation to complete before returning control.

The class will use do_events to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and remains responsive.

If timeout expires, and the operation is not yet complete, the class fails with an error.

Please note that by default, all timeouts are inactivity timeouts, i.e. the timeout period is extended by timeout seconds when any amount of data is successfully sent or received.

The default value for the timeout property is 60 seconds.

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

accept_dataEnables or disables data reception (the DataIn event).
bytes_sentThe number of bytes actually sent after an assignment to DataToSend .
connectedTriggers a connection or disconnection.
data_to_sendA string of data to be sent over the connected pipe.
eolUsed to break the incoming data stream into chunks separated by EOL.
pipe_nameThe name of the pipe.
record_lengthThe length of received data records.
single_line_modeSpecial mode for line-oriented protocols.
timeoutA timeout for the class.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

configSets or retrieves a configuration setting.
connectConnects to a named pipe.
disconnectDisconnects from the named pipe.
do_eventsProcesses events from the internal message queue.
get_lineGets a line of text from the server.
interruptInterrupts the current action.
sendSends data over the connected pipe.
send_fileSends the file over the connected pipe.
send_lineSends a string followed by a newline.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

on_connectedFired immediately after a connection completes.
on_data_inFired when data (complete lines) comes in.
on_disconnectedFired when a connection is closed.
on_errorInformation about errors during data delivery.
on_ready_to_sendFired when the class is ready to send data.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

AbsoluteTimeoutDetermines whether timeouts are inactivity timeouts or absolute timeouts.
InBufferSizeThe size in bytes of the output buffer.
MaxLineLengthThe maximum amount of data to accumulate when no EOL is found.
OutBufferSizeThe size in bytes of the input buffer.
PipeDirectionDetermines the direction data flows.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IPC 2020 Python Edition - Version 20.0 [Build 8155]