public class TCPNetworkModule extends java.lang.Object implements NetworkModule
Constructor and Description |
---|
TCPNetworkModule(javax.net.SocketFactory factory,
java.lang.String host,
int port,
java.lang.String resourceContext)
Constructs a new TCPNetworkModule using the specified host and
port.
|
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
getInputStream() |
java.io.OutputStream |
getOutputStream() |
java.lang.String |
getServerURI() |
void |
setConnectTimeout(int timeout)
Set the maximum time to wait for a socket to be established
|
void |
start()
Starts the module, by creating a TCP socket to the server.
|
void |
stop()
Stops the module, by closing the TCP socket.
|
public TCPNetworkModule(javax.net.SocketFactory factory, java.lang.String host, int port, java.lang.String resourceContext)
public void start() throws java.io.IOException, MqttException
start
in interface NetworkModule
java.io.IOException
MqttException
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in interface NetworkModule
java.io.IOException
public java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface NetworkModule
java.io.IOException
public void stop() throws java.io.IOException
stop
in interface NetworkModule
java.io.IOException
public void setConnectTimeout(int timeout)
timeout
- public java.lang.String getServerURI()
getServerURI
in interface NetworkModule