Public 成员函数 | |
| None | __init__ (self, str ipAddress, int port) |
| 初始化一个新的实例,使用指定的 IP 地址和端口号。 | |
| "TcpComm" | from_descriptor (cls, str descriptor, DescriptorPortType port_type) |
| 从描述符字符串和端口类型创建一个 TcpComm 对象。 | |
| None | open (self) |
| 打开与TCP服务器的连接。 | |
| str | get_ip_address (self) |
| 获取远程服务器的IP地址。 | |
| connection_settings (self, ip_address, port) | |
| 使用指定的IP地址和端口配置连接设置。 | |
| bool | is_connected (self) |
| 指示连接是否已建立的标志。 | |
| None | close (self) |
| 关闭与TCP服务器的连接。 | |
| None | write (self, bytes text) |
| 将数据写入TCP服务器。 | |
| Optional[bytes] | read (self) |
| 从TCP服务器读取数据。 | |
| None | wait_for_data (self, int msTimeout) |
| 等待TCP连接上有数据可用。 | |
| Optional[bytes] | write_and_wait_for_response (self, bytes text, int responseStartTimeout, int responseEndTimeout, str completionToken="") |
| 将数据写入TCP服务器并等待响应。 | |
| Optional[bytes] | write_and_wait_for_response_json (self, bytes text, int responseStartTimeout, int responseEndTimeout, str completionToken="") |
| 将JSON数据写入TCP服务器并等待响应。 | |
| write_printer_file (self, str fileName) | |
| 将文件写入印表机。 | |
| None | send_printer_file (self, str ipAddress, str fileName) |
| 发送打印文件到指定的IP地址。 | |
| None | send_print_string (self, str ipAddress, bytes data) |
| 使用 TSPL 或 PGL 将打印字符串发送到指定的IP地址。 | |
静态 Public 成员函数 | |
| Tuple[str, int] | parse_descriptor (str descriptor, DescriptorPortType port_type) |
| str | descriptor_validate (str descriptor_hint, DescriptorPortType port_type_hint) |
| 使用指定的提示和端口类型验证描述符。 | |
| str | descriptor_use_ip (str ip, int port) |
| 使用指定的IP和端口返回一个描述符字符串。 | |
Protected 属性 | |
| _socket | |
| _ip | |
| _port | |
| _connected | |
| None TcpComm.TcpComm.__init__ | ( | self, | |
| str | ipAddress, | ||
| int | port ) |
初始化一个新的实例,使用指定的 IP 地址和端口号。
| ipAddress | TCP 服务器的 IP 地址。 |
| port | TCP 服务器的端口号。 |
| None TcpComm.TcpComm.close | ( | self | ) |
关闭与TCP服务器的连接。
| TcpComm.TcpComm.connection_settings | ( | self, | |
| ip_address, | |||
| port ) |
使用指定的IP地址和端口配置连接设置。
| ip_address | 远程服务器的IP地址。 |
| port | 连接到远程服务器的端口号。 |
|
static |
使用指定的IP和端口返回一个描述符字符串。
| ip | 用于描述符的IP地址。 |
| port | 用于描述符的端口。 |
|
static |
使用指定的提示和端口类型验证描述符。
| descriptor_hint | 描述符的提示。 |
| port_type_hint | 要验证的端口类型。 |
| "TcpComm" TcpComm.TcpComm.from_descriptor | ( | cls, | |
| str | descriptor, | ||
| DescriptorPortType | port_type ) |
| str TcpComm.TcpComm.get_ip_address | ( | self | ) |
获取远程服务器的IP地址。
| bool TcpComm.TcpComm.is_connected | ( | self | ) |
指示连接是否已建立的标志。
| None TcpComm.TcpComm.open | ( | self | ) |
打开与TCP服务器的连接。
|
static |
| Optional[bytes] TcpComm.TcpComm.read | ( | self | ) |
从TCP服务器读取数据。
| None TcpComm.TcpComm.send_print_string | ( | self, | |
| str | ipAddress, | ||
| bytes | data ) |
使用 TSPL 或 PGL 将打印字符串发送到指定的IP地址。
| ipAddress | 印表机的IP地址。 |
| data | 要打印的数据。 |
| None TcpComm.TcpComm.send_printer_file | ( | self, | |
| str | ipAddress, | ||
| str | fileName ) |
发送打印文件到指定的IP地址。
| ipAddress | 印表机的IP地址。 |
| fileName | 要打印的文件名。 |
| None TcpComm.TcpComm.wait_for_data | ( | self, | |
| int | msTimeout ) |
等待TCP连接上有数据可用。
| msTimeout | 超时间隔(毫秒)。 |
| None TcpComm.TcpComm.write | ( | self, | |
| bytes | text ) |
将数据写入TCP服务器。
| text | 要写入服务器的数据。 |
| Optional[bytes] TcpComm.TcpComm.write_and_wait_for_response | ( | self, | |
| bytes | text, | ||
| int | responseStartTimeout, | ||
| int | responseEndTimeout, | ||
| str | completionToken = "" ) |
将数据写入TCP服务器并等待响应。
| text | 要写入服务器的数据。 |
| responseStartTimeout | 响应开始的超时间隔。 |
| responseEndTimeout | 响应结束的超时间隔。 |
| completionToken | 表示响应完成的令牌。 |
| Optional[bytes] TcpComm.TcpComm.write_and_wait_for_response_json | ( | self, | |
| bytes | text, | ||
| int | responseStartTimeout, | ||
| int | responseEndTimeout, | ||
| str | completionToken = "" ) |
将JSON数据写入TCP服务器并等待响应。
| text | 要写入服务器的JSON数据。 |
| responseStartTimeout | 响应开始的超时间隔。 |
| responseEndTimeout | 响应结束的超时间隔。 |
| completionToken | 表示响应完成的令牌。 |
| TcpComm.TcpComm.write_printer_file | ( | self, | |
| str | fileName ) |
将文件写入印表机。
| fileName | 要写入印表机的文件名。 |
|
protected |
|
protected |
|
protected |
|
protected |