Class that implements the TCP specific communication and extends the AComm class. More...
Classes | |
enum | DescriptorPortType |
Types for requesting descriptors with default port values. More... | |
Public Member Functions | |
TcpConnection (String descriptor) throws IllegalArgumentException | |
Initialize new class instance based on descriptor string. More... | |
TcpConnection (String ipAddress, int port) | |
Initialize new class instance. | |
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 () |
Returns a string description of the connection. Format: "TCP:ip:port" e.g. "TCP:127.0.0.1:9100". More... | |
String | IpAddress () |
IP address of connection. | |
void | Open () |
Opens a connection. | |
int | Port () |
Port Number of 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) |
Waits until data available BytesAvailable in current thread. Current thread sleeps until data received or timeout reached. Blocking call. More... | |
void | Write (byte[] dataOut) |
Writes all bytes from the array passed in. | |
void | Write (InputStream binReader) throws IOException |
Write from input stream to output stream More... | |
byte[] | WriteAndWaitForResponse (byte[] dataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException |
Write byte data to output stream and return data received. Data returned is any data received or up to completion token if received. Wait for response timeout before returning. More... | |
void | WriteAndWaitForResponse (OutputStream binDataIn, InputStream binDataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException |
Write binDataOut stream data to output stream and return data received in binDataIn stream. Data returned is any data received or up to completion token if received. Wait for response timeout before returning. More... | |
Static Public Member Functions | |
static String | DescriptorValidate (String descriptorHint, DescriptorPortType portTypeHint) |
Validate/build descriptor string from descriptorHint that may or may not have a port. Returns valid descriptor or empty "" string. More... | |
Static Public Attributes | |
static final int | DEFAULT_DATA_PORT = 9100 |
Port for sending print data. | |
static final int | DEFAULT_MGMT_PORT = 3007 |
Port used to control and manage printers. | |
static final int | DEFAULT_STATUS_PORT = 3002 |
Port for listening to status messages from printer. More... | |
Class that implements the TCP specific communication and extends the AComm class.
TcpConnection | ( | String | descriptor | ) | throws IllegalArgumentException |
Initialize new class instance based on descriptor string.
[in] | descriptor | Colon (:) separated string description of connection. Acceptable Formats:
|
String Descriptor | ( | ) |
Returns a string description of the connection. Format: "TCP:ip:port" e.g. "TCP:127.0.0.1:9100".
Format returned:
Note that "TCP" prefix on returned string to denote the type of connection.
Implements IComm.
|
static |
Validate/build descriptor string from descriptorHint that may or may not have a port. Returns valid descriptor or empty "" string.
descriptorHint accepted values:
|
inherited |
Waits until data available BytesAvailable in current thread. Current thread sleeps until data received or timeout reached. Blocking call.
[in] | msTimeOut | Millisecond timeout before return if no data received. |
Implements IComm.
|
inherited |
Write from input stream to output stream
[in] | binReader | Source data to send |
Implements IComm.
|
inherited |
Write byte data to output stream and return data received. Data returned is any data received or up to completion token if received. Wait for response timeout before returning.
byte[] | Array of bytes received from connection. Data returned is any data received or up to completetionToken if token received |
[in] | dataOut | Source byte array to write to connection. |
[in] | responseStartTimeOut | Timeout to wait for first data to be received. Time to first byte. |
[in] | responseEndTimeOut | Timeout of no new data received. Time after last byte. |
[in] | completetionToken | String token denoting the end of the response expected. This can be empty string if simply want to wait for response after writing data to connection. |
Implements IComm.
|
inherited |
Write binDataOut stream data to output stream and return data received in binDataIn stream. Data returned is any data received or up to completion token if received. Wait for response timeout before returning.
[out] | binDataIn | Destination stream to store response received from connection. |
[in] | binDataOut | Source stream data to write to connection. |
[in] | responseStartTimeOut | Timeout to wait for first data to be received. Time to first byte. |
[in] | responseEndTimeOut | Timeout of no new data received. Time after last byte. |
[in] | completetionToken | String token denoting the end of the response expected. This can be empty string if simply want to wait for response after writing data to connection. |
Implements IComm.
|
static |
Port for listening to status messages from printer.
Printer may be configured to send status messages to different ports based on the "Ret. Status Port" setting on the printer. If the "Ret. Status Port" is set to "E-NET Stat Port", the printer may send status messages to the "Status Port Number" setting which has a default of 3002.
e.g. Emulation (printer language such as PGL) diagnostic messages from printer.
e.g. Capturing ODV barcode data and grade with the following printer menu settings: