org.eclipse.paho.client.mqttv3.internal
Class TCPNetworkModule

java.lang.Object
  extended by org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule
All Implemented Interfaces:
NetworkModule
Direct Known Subclasses:
SSLNetworkModule

public class TCPNetworkModule
extends Object
implements NetworkModule

A network module for connecting over TCP.


Field Summary
protected  Socket socket
           
 
Constructor Summary
TCPNetworkModule(SocketFactory factory, String host, int port, String resourceContext)
          Constructs a new TCPNetworkModule using the specified host and port.
 
Method Summary
 InputStream getInputStream()
           
 OutputStream getOutputStream()
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socket

protected Socket socket
Constructor Detail

TCPNetworkModule

public TCPNetworkModule(SocketFactory factory,
                        String host,
                        int port,
                        String resourceContext)
Constructs a new TCPNetworkModule using the specified host and port. The supplied SocketFactory is used to supply the network socket.

Method Detail

start

public void start()
           throws IOException,
                  MqttException
Starts the module, by creating a TCP socket to the server.

Specified by:
start in interface NetworkModule
Throws:
IOException
MqttException

getInputStream

public InputStream getInputStream()
                           throws IOException
Specified by:
getInputStream in interface NetworkModule
Throws:
IOException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Specified by:
getOutputStream in interface NetworkModule
Throws:
IOException

stop

public void stop()
          throws IOException
Stops the module, by closing the TCP socket.

Specified by:
stop in interface NetworkModule
Throws:
IOException

setConnectTimeout

public void setConnectTimeout(int timeout)
Set the maximum time to wait for a socket to be established

Parameters:
timeout -


Copyright © 2013. All Rights Reserved.