Class TcpLink
java.lang.Object
com.codename1.io.link.ByteLink
com.codename1.io.link.StreamLink
com.codename1.io.link.TcpLink
A TCP connection to a device on the local network: a receipt printer on port 9100, a ZVT or nexo terminal on its configured port.
Needs Socket.isSupported(): the desktop ports, Android and iOS. A web
page cannot open raw sockets.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidopen()Connects.voidsetConnectTimeout(int connectTimeout) How longopen()waits for the connection.Methods inherited from class StreamLink
close, isOpen, read, setStreams, write
-
Constructor Details
-
TcpLink
Parameters
-
host: the device's address -
port: its port
-
-
-
Method Details
-
setConnectTimeout
public void setConnectTimeout(int connectTimeout) How long
open()waits for the connection. Defaults to ten seconds.Parameters
connectTimeout: the limit in milliseconds
-
open
Description copied from class:ByteLinkConnects. Does nothing when already open.
Throws
IOException: when the device cannot be reached
- Overrides:
openin classStreamLink- Throws:
IOException
-