实现 TCP 特定通信并扩展 AComm 类的类。 更多...
类 | |
enum | DescriptorPortType |
请求带有默认端口值的描述符的类型。 更多... | |
Public 成员函数 | |
int | GetPort () |
TcpConnection (String descriptor) | |
根据 descriptor 字符串初始化新类实例。 更多... | |
TcpConnection (String ipAddress, int port) | |
String | IpAddress () |
IP address of connection 更多... | |
int | Port () |
Port Number of connection 更多... | |
int | BytesAvailable () |
boolean | Connected () |
String | Descriptor () |
返回连接的字符串描述。格式:"<b>TCP</b>:ip:port" 例如:"<b>TCP</b>:127.0.0.1:9100" 更多... | |
void | Close () |
void | Open () |
byte[] | Read () |
void | Write (byte[] dataOut) |
![]() | |
void | Read (OutputStream binDataIn) throws IOException |
void | WaitForData (int msTimeOut) |
等待当前线程有可用数据 BytesAvailable。当前线程会休眠直到接收到数据或超时为止。此为阻塞调用。 更多... | |
void | Write (InputStream binReader) throws IOException |
从输入流写入输出流。 更多... | |
void | WriteAndWaitForResponse (OutputStream binDataIn, InputStream binDataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException |
将 binDataOut 流数据写入输出流,并将接收到的数据返回到 binDataIn 流中。返回的数据是收到的数据或收到的完成标记。等待响应超时后返回。 更多... | |
byte[] | WriteAndWaitForResponse (byte[] dataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException |
将字节数据写入输出流并返回接收到的数据。返回的数据是接收到的任何数据或收到的完成标记。等待响应超时后返回。 更多... | |
静态 Public 成员函数 | |
static String | DescriptorValidate (String descriptorHint, DescriptorPortType portTypeHint) |
从可能有或没有端口的 descriptorHint 验证/构建描述符字符串。返回有效的描述符或空的 "" 字符串。 更多... | |
静态 Public 属性 | |
static final int | DEFAULT_DATA_PORT = 9100 |
Port for sending print data 更多... | |
static final int | DEFAULT_STATUS_PORT = 3002 |
Port for listening to status messages from printer. 更多... | |
static final int | DEFAULT_MGMT_PORT = 3007 |
Port used to control and manage printers. 更多... | |
Private 成员函数 | |
void | ConnectionSettings (String ipAddress, int port) |
Private 属性 | |
String | _ipAddress = "" |
int | _port = 0 |
Socket | _client |
InputStream | _inStream |
OutputStream | _outStream |
实现 TCP 特定通信并扩展 AComm 类的类。
com.UniPRT.Sdk.Comm.TcpConnection.TcpConnection | ( | String | descriptor | ) |
根据 descriptor 字符串初始化新类实例。
[in] | descriptor | 用冒号(:)分隔的连接描述字符串。 可接受的格式:
|
引用了 com.UniPRT.Sdk.Comm.TcpConnection.DescriptorPortType.DATA , 以及 com.UniPRT.Sdk.Comm.TcpConnection.DescriptorValidate().
com.UniPRT.Sdk.Comm.TcpConnection.TcpConnection | ( | String | ipAddress, |
int | port | ||
) |
int com.UniPRT.Sdk.Comm.TcpConnection.BytesAvailable | ( | ) |
Get the number of bytes available to read.
void com.UniPRT.Sdk.Comm.TcpConnection.Close | ( | ) |
boolean com.UniPRT.Sdk.Comm.TcpConnection.Connected | ( | ) |
Check if connection is established.
|
private |
String com.UniPRT.Sdk.Comm.TcpConnection.Descriptor | ( | ) |
返回连接的字符串描述。格式:"<b>TCP</b>:ip:port" 例如:"<b>TCP</b>:127.0.0.1:9100"
返回的格式:
注意返回的字符串中以 "<b>TCP</b>" 前缀来标示连接类型。
实现了 com.UniPRT.Sdk.Comm.IComm.
引用了 com.UniPRT.Sdk.Comm.TcpConnection._ipAddress , 以及 com.UniPRT.Sdk.Comm.TcpConnection._port.
|
static |
从可能有或没有端口的 descriptorHint 验证/构建描述符字符串。返回有效的描述符或空的 "" 字符串。
descriptorHint 接受的值:
引用了 com.UniPRT.Sdk.Comm.TcpConnection.DescriptorPortType.DATA, com.UniPRT.Sdk.Comm.TcpConnection.DEFAULT_DATA_PORT, com.UniPRT.Sdk.Comm.TcpConnection.DEFAULT_MGMT_PORT, com.UniPRT.Sdk.Comm.TcpConnection.DEFAULT_STATUS_PORT, com.UniPRT.Sdk.Comm.TcpConnection.DescriptorPortType.MGMT , 以及 com.UniPRT.Sdk.Comm.TcpConnection.DescriptorPortType.STATUS.
被这些函数引用 com.UniPRT.Sdk.Comm.Communication.CreateComm() , 以及 com.UniPRT.Sdk.Comm.TcpConnection.TcpConnection().
int com.UniPRT.Sdk.Comm.TcpConnection.GetPort | ( | ) |
String com.UniPRT.Sdk.Comm.TcpConnection.IpAddress | ( | ) |
IP address of connection
void com.UniPRT.Sdk.Comm.TcpConnection.Open | ( | ) |
int com.UniPRT.Sdk.Comm.TcpConnection.Port | ( | ) |
Port Number of connection
byte [] com.UniPRT.Sdk.Comm.TcpConnection.Read | ( | ) |
void com.UniPRT.Sdk.Comm.TcpConnection.Write | ( | byte[] | dataOut | ) |
Write all bytes from the array passed in.
dataOut | Byte array to write. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
static |
Port for sending print data
被这些函数引用 com.UniPRT.Sdk.Comm.TcpConnection.DescriptorValidate(), com.UniPRT.Sdk.Utilities.Utilities.SendPrintFile() , 以及 com.UniPRT.Sdk.Utilities.Utilities.SendPrintString().
|
static |
Port used to control and manage printers.
被这些函数引用 com.UniPRT.Sdk.Comm.TcpConnection.DescriptorValidate().
|
static |
Port for listening to status messages from printer.
印表机可以根据 "Ret. Status Port" 设置来配置将状态讯息发送到不同的端口。 如果 "Ret. Status Port" 设置为 "E-NET Stat Port",则印表机可能会将状态讯息发送到 "Status Port Number" 设置,默认值为 3002。
例如:来自印表机的仿真(如 PGL 打印语言)诊断讯息。
例如:通过以下印表机菜单设置捕获 ODV 条码数据和等级:
被这些函数引用 com.UniPRT.Sdk.Comm.TcpConnection.DescriptorValidate().