|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.amx.duet.tools.net.udp.DatagramSocketConnection
This class is used to manage datagram socket connections on a single thread making it safe for AMX masters.
Field Summary | |
static int |
FAILED_CREATE_DATAGRAM_SOCKET
|
static int |
FAILED_DATAGRAM_READ
|
static int |
FAILED_DATAGRAM_WRITE
|
static int |
INFINITE
|
static int |
INVALID_HOST
|
static int |
TIMEOUT
|
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
DatagramSocketConnection(java.net.InetAddress addr,
int port,
int bufferSize,
ISocketConnectionListener listener)
Creates a simple socket connection along with a receive thread for reading the socket. |
|
DatagramSocketConnection(java.net.InetAddress addr,
int port,
int bufferSize,
ISocketConnectionListener listener,
int timeout)
Creates a simple socket along with a receive thread for reading the socket. |
|
DatagramSocketConnection(java.lang.String host,
int port,
int bufferSize,
ISocketConnectionListener listener)
Creates a simple socket along with a receive thread for reading the socket. |
|
DatagramSocketConnection(java.lang.String host,
int port,
int bufferSize,
ISocketConnectionListener listener,
int timeout)
Creates a simple socket along with a receive thread for reading the socket. |
Method Summary | |
void |
dispose()
Closes this socket connection and sets it to null. |
int |
getDebugState()
Gets the current diagnostic state. |
void |
run()
|
void |
setAddressAndPort(java.lang.String host,
int port)
Sets the IP address and Port to be used with a datagram packet. |
void |
setDebugState(int nState)
Puts the class into a debug diagnostic state. |
boolean |
write(byte[] data)
Writes data to the datagram Socket. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int INVALID_HOST
public static final int FAILED_CREATE_DATAGRAM_SOCKET
public static final int FAILED_DATAGRAM_WRITE
public static final int FAILED_DATAGRAM_READ
public static final int TIMEOUT
public static final int INFINITE
Constructor Detail |
public DatagramSocketConnection(java.net.InetAddress addr, int port, int bufferSize, ISocketConnectionListener listener)
addr
- InetAddress object indicating the host to connect toport
- integer port number to connect tobufferSize
- integer size of maximum receive bufferlistener
- SocketReceiveHandler object that will be called when data is received on a
sockect or when an error occurs.public DatagramSocketConnection(java.lang.String host, int port, int bufferSize, ISocketConnectionListener listener)
host
- String name of host to connect toport
- port number to connect tobufferSize
- integer size of maximum receive bufferlistener
- SocketReceiveHandler object that will be called when data is received on a
sockect or when an error occurs.public DatagramSocketConnection(java.net.InetAddress addr, int port, int bufferSize, ISocketConnectionListener listener, int timeout)
addr
- host String name of host to connect toport
- port number to connect tobufferSize
- integer size of maximum receive bufferlistener
- SocketReceiveHandler object that will be called when data is received on a
sockect or when an error occurs.timeout
- number of milliseconds to wait for received datapublic DatagramSocketConnection(java.lang.String host, int port, int bufferSize, ISocketConnectionListener listener, int timeout)
host
- String name of host to connect toport
- port number to connect tobufferSize
- integer size of maximum receive bufferlistener
- SocketReceiveHandler object that will be called when data is received on a
sockect or when an error occurs.timeout
- number of milliseconds to wait for received dataMethod Detail |
public void setAddressAndPort(java.lang.String host, int port)
host
- port
- public void dispose()
public boolean write(byte[] data)
data
- byte array containing data to write
public void run()
public void setDebugState(int nState)
nState
- public int getDebugState()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |