實作 TCP 特定通訊並擴展 AComm 類別的類別。 更多...
複合項目 | |
enum | DescriptorPortType |
請求帶有預設端口值的描述符的類型。 更多... | |
公開方法(Public Methods) | |
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 |
將位元組資料寫入輸出流並返回接收到的資料。返回的資料是接收到的任何資料或收到的完成標記。等待回應超時後返回。 更多... | |
靜態公開方法(Static Public Methods) | |
static String | DescriptorValidate (String descriptorHint, DescriptorPortType portTypeHint) |
從可能有或沒有端口的 descriptorHint 驗證/構建描述符字串。返回有效的描述符或空的 "" 字串。 更多... | |
靜態公開屬性 | |
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 Methods) | |
void | ConnectionSettings (String ipAddress, int port) |
私有屬性 | |
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.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 | ( | ) |
Read all available bytes.
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().