UniPRT SDK  v1.0.0.0
AComm 類別 參考文件abstract

抽象類別,實作 IComm 介面的預設功能。 更多...

類別AComm的繼承圖:
IComm TcpConnection

公開方法(Public Methods)

int BytesAvailable ()
 Number of bytes available to read. This is estimate and number can change as data is received.
 
void Close ()
 Closes a connection.
 
boolean Connected ()
 true if connection is established
 
String Descriptor ()
 string descriptor of the connection.
 
void Open ()
 Opens a connection.
 
byte[] Read ()
 Read all bytes available.
 
void Read (OutputStream binDataIn) throws IOException
 Reads all bytes available into the stream passed in.
 
void WaitForData (int msTimeOut)
 等待當前執行緒有可用的資料 BytesAvailable。當前執行緒會休眠直到收到資料或超時為止。此為阻塞呼叫。 更多...
 
void Write (byte[] dataOut)
 Writes all bytes from the array passed in.
 
void Write (InputStream binReader) throws IOException
 從輸入流寫入輸出流。 更多...
 
byte[] WriteAndWaitForResponse (byte[] dataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException
 將位元組資料寫入輸出流並返回接收到的資料。返回的資料是接收到的任何資料或收到的完成標記。等待回應超時後返回。 更多...
 
void WriteAndWaitForResponse (OutputStream binDataIn, InputStream binDataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException
 將 binDataOut 流資料寫入輸出流,並將接收到的資料返回到 binDataIn 流中。返回的資料是收到的資料或收到的完成標記。等待回應超時後返回。 更多...
 

詳細描述

抽象類別,實作 IComm 介面的預設功能。

函式成員說明文件

◆ WaitForData()

void WaitForData ( int  msTimeOut)

等待當前執行緒有可用的資料 BytesAvailable。當前執行緒會休眠直到收到資料或超時為止。此為阻塞呼叫。

參數
[in]msTimeOut在沒有收到資料前返回的毫秒超時。

實作 IComm.

◆ Write()

void Write ( InputStream  binReader) throws IOException

從輸入流寫入輸出流。

參數
[in]binReader要傳送的來源資料。

實作 IComm.

◆ WriteAndWaitForResponse() [1/2]

byte [] WriteAndWaitForResponse ( byte[]  dataOut,
int  responseStartTimeOut,
int  responseEndTimeOut,
String  completionToken 
) throws IOException

將位元組資料寫入輸出流並返回接收到的資料。返回的資料是接收到的任何資料或收到的完成標記。等待回應超時後返回。

傳回值
byte[]從連接接收到的位元組陣列。
返回的資料是接收到的任何資料或收到的完成標記。
參數
[in]dataOut要寫入連接的來源位元組陣列。
[in]responseStartTimeOut等待接收到第一個資料的超時。從第一個字節開始計時。
[in]responseEndTimeOut沒有新資料接收的超時。從最後一個字節後開始計時。
[in]completetionToken標示預期回應結束的字串標記。如果只是想在寫入資料到連接後等待回應,可以是空字串。

實作 IComm.

◆ WriteAndWaitForResponse() [2/2]

void WriteAndWaitForResponse ( OutputStream  binDataIn,
InputStream  binDataOut,
int  responseStartTimeOut,
int  responseEndTimeOut,
String  completionToken 
) throws IOException

將 binDataOut 流資料寫入輸出流,並將接收到的資料返回到 binDataIn 流中。返回的資料是收到的資料或收到的完成標記。等待回應超時後返回。

參數
[out]binDataIn用於存儲從連接接收到的回應的目標流。
[in]binDataOut寫入連接的來源流資料。
[in]responseStartTimeOut等待接收到第一個資料的超時。從第一個字節開始計時。
[in]responseEndTimeOut沒有新資料接收的超時。從最後一個字節後開始計時。
[in]completetionToken標示預期回應結束的字串標記。如果只是想在寫入資料到連接後等待回應,可以是空字串。

實作 IComm.