net.wimpi.modbus.net
Class ModbusTCPListener

java.lang.Object
  extended by net.wimpi.modbus.net.ModbusTCPListener
All Implemented Interfaces:
Runnable

public class ModbusTCPListener
extends Object
implements Runnable

Class that implements a ModbusTCPListener.
If listening, it accepts incoming requests passing them on to be handled.

Version:
@version@ (@date@)
Author:
Dieter Wimberger

Constructor Summary
ModbusTCPListener(int poolsize)
          Constructs a ModbusTCPListener instance.
ModbusTCPListener(int poolsize, InetAddress addr)
          Constructs a ModbusTCPListener instance.
 
Method Summary
 boolean isListening()
          Tests if this ModbusTCPListener is listening and accepting incoming connections.
 void run()
          Accepts incoming connections and handles then with TCPConnectionHandler instances.
 void setAddress(InetAddress addr)
          Sets the address of the interface to be listened to.
 void setPort(int port)
          Sets the port to be listened to.
 void start()
          Starts this ModbusTCPListener.
 void stop()
          Stops this ModbusTCPListener.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModbusTCPListener

public ModbusTCPListener(int poolsize)
Constructs a ModbusTCPListener instance.

Parameters:
poolsize - the size of the ThreadPool used to handle incoming requests.

ModbusTCPListener

public ModbusTCPListener(int poolsize,
                         InetAddress addr)
Constructs a ModbusTCPListener instance.

Parameters:
poolsize - the size of the ThreadPool used to handle incoming requests.
addr - the interface to use for listening.
Method Detail

setPort

public void setPort(int port)
Sets the port to be listened to.

Parameters:
port - the number of the IP port as int.

setAddress

public void setAddress(InetAddress addr)
Sets the address of the interface to be listened to.

Parameters:
addr - an InetAddress instance.

start

public void start()
Starts this ModbusTCPListener.


stop

public void stop()
Stops this ModbusTCPListener.


run

public void run()
Accepts incoming connections and handles then with TCPConnectionHandler instances.

Specified by:
run in interface Runnable

isListening

public boolean isListening()
Tests if this ModbusTCPListener is listening and accepting incoming connections.

Returns:
true if listening (and accepting incoming connections), false otherwise.


Copyright © 2010. All Rights Reserved.