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_data | Enables or disables data reception (the DataIn event). |
bytes_sent | The number of bytes actually sent after an assignment to DataToSend . |
connected | Triggers a connection or disconnection. |
data_to_send | A string of data to be sent over the connected pipe. |
eol | Used to break the incoming data stream into chunks separated by EOL. |
pipe_name | The name of the pipe. |
record_length | The length of received data records. |
single_line_mode | Special mode for line-oriented protocols. |
timeout | A 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.
config | Sets or retrieves a configuration setting. |
connect | Connects to a named pipe. |
disconnect | Disconnects from the named pipe. |
do_events | Processes events from the internal message queue. |
get_line | Gets a line of text from the server. |
interrupt | Interrupts the current action. |
send | Sends data over the connected pipe. |
send_file | Sends the file over the connected pipe. |
send_line | Sends 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_connected | Fired immediately after a connection completes. |
on_data_in | Fired when data (complete lines) comes in. |
on_disconnected | Fired when a connection is closed. |
on_error | Information about errors during data delivery. |
on_ready_to_send | Fired 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.
AbsoluteTimeout | Determines whether timeouts are inactivity timeouts or absolute timeouts. |
InBufferSize | The size in bytes of the output buffer. |
MaxLineLength | The maximum amount of data to accumulate when no EOL is found. |
OutBufferSize | The size in bytes of the input buffer. |
PipeDirection | Determines the direction data flows. |
BuildInfo | Information about the product's build. |
CodePage | The system code page used for Unicode to Multibyte translations. |
LicenseInfo | Information about the current license. |
ProcessIdleEvents | Whether the class uses its internal event loop to process events when the main thread is idle. |
SelectWaitMillis | The length of time in milliseconds the class will wait when DoEvents is called if there are no events to process. |
UseInternalSecurityAPI | Tells the class whether or not to use the system security libraries or an internal implementation. |