public class TcpConnection extends ConnectionA implements IpAddressable
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CPCL_TCP_PORT
The default TCP port for CPCL devices.
|
static int |
DEFAULT_ZPL_TCP_PORT
The default TCP port for ZPL devices.
|
| Constructor and Description |
|---|
TcpConnection(String address,
int port)
Initializes a new instance of the
TcpConnection class. |
TcpConnection(String address,
int port,
int maxTimeoutForRead,
int timeToWaitForMoreData)
Initializes a new instance of the
TcpConnection class. |
| Modifier and Type | Method and Description |
|---|---|
String |
getAddress()
Returns the address which was passed into the constructor.
|
ConnectionReestablisher |
getConnectionReestablisher(long thresholdTime)
Returns a
ConnectionReestablisher which allows for easy recreation of a connection which may have
been closed. |
String |
getPortNumber()
Returns the port number which was passed into the constructor.
|
String |
getSimpleConnectionName()
Return the IP address as the description.
|
String |
toString()
Returns
TCP:[address]:[port number].The address and port number are the parameters which were passed into the constructor. |
addWriteLogStream, bytesAvailable, close, getManufacturer, getMaxDataToWrite, getMaxTimeoutForRead, getTimeToWaitForMoreData, isConnected, open, read, read, read, read, readChar, sendAndWaitForResponse, sendAndWaitForResponse, sendAndWaitForValidResponse, sendAndWaitForValidResponse, setMaxDataToWrite, setMaxTimeoutForRead, setReadTimeout, setTimeToWaitForMoreData, waitForData, write, write, writepublic static final int DEFAULT_ZPL_TCP_PORT
public static final int DEFAULT_CPCL_TCP_PORT
public TcpConnection(String address,
int port)
TcpConnection class. This constructor will use the default
timeouts for Connection.read(). The default timeout is a maximum of 5 seconds for any data to be
received. If no more data is available after 500 milliseconds the read operation is assumed to be complete.TcpConnection(String, int, int, int).address - the IP Address or DNS Hostname.port - the port number.public TcpConnection(String address,
int port,
int maxTimeoutForRead,
int timeToWaitForMoreData)
TcpConnection class. This constructor will use the specified
timeouts for Connection.read(). The timeout is a maximum of maxTimeoutForRead milliseconds
for any data to be received. If no more data is available after timeToWaitForMoreData milliseconds
the read operation is assumed to be complete.address - the IP Address or DNS Hostname.port - the port number.maxTimeoutForRead - the maximum time, in milliseconds, to wait for any data to be received.timeToWaitForMoreData - the maximum time, in milliseconds, to wait in-between reads after the initial read.public String toString()
TCP:[address]:[port number].address and port number are the parameters which were passed into the constructor.toString in interface ConnectiontoString in class ObjectConnection.toString()public String getSimpleConnectionName()
getSimpleConnectionName in interface ConnectionConnection.getSimpleConnectionName()public String getAddress()
IpAddressablegetAddress in interface IpAddressableIpAddressable.getAddress()public String getPortNumber()
IpAddressablegetPortNumber in interface IpAddressableIpAddressable.getPortNumber()public ConnectionReestablisher getConnectionReestablisher(long thresholdTime) throws ConnectionException
ConnectionConnectionReestablisher which allows for easy recreation of a connection which may have
been closed.
getConnectionReestablisher in interface ConnectiongetConnectionReestablisher in class ConnectionAthresholdTime - how long the Connection reestablisher will wait before attempting to reconnection to the
printerConnectionException - if the ConnectionReestablisher could not be created.ConnectionA.getConnectionReestablisher(long thresholdTime)
© 2017 ZIH Corp. All Rights Reserved.