|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
com.alarexgroup.m2mplf.net.tcpip.ClientSocketCommunicator
public class ClientSocketCommunicator
Class for TCP-IP comunication. This class behaves as a client.
Example:
import com.alarexgroup.m2mplf.M2Mlet;
|
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static int |
ERROR_CODE_ALL_OK
All right |
static int |
ERROR_CODE_CONNECTION_NOT_FOUND
Establish contact isn't possible. |
static int |
ERROR_CODE_INVALID_PARAMETERS
Bad format of address or connectionProfile |
static int |
ERROR_CODE_IO_EXCEPTION
IO exception |
static int |
ERROR_CODE_SECURITY_EXCEPTION
J2ME security error |
static int |
ERROR_CODE_UNKNOWN_ERROR
Unknown error |
static int |
longSleep
Optimalization of performance and module's processor load Time (ms) when thread sleep - thread is waiting for input data. |
static int |
shortSleep
Optimalization of performance and module's processor load Time (ms) of thread sleep - thread is waiting for input data. |
static byte |
SOCKET_OPTION_DELAY
Value 0 turns off Nagle algorithm for operations with buffer. |
static byte |
SOCKET_OPTION_KEEPALIVE
Value 0 turns off KEEPALIVE Value 0 provides active KEEPALIVE |
static byte |
SOCKET_OPTION_LINGER
Value is the time, during which dates are processing untill the connection is closed (0 = off, value isn't 0 = time in sec. ) |
static byte |
SOCKET_OPTION_RCVBUF
Buffer size - dates receipt |
static byte |
SOCKET_OPTION_SNDBUF
Buffer size - dates sending |
static int |
timeForSleep
Thread enters into slower mode After this time (since last comunication). |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Method Summary | |
|---|---|
int |
closeConnection()
Closes conection |
static ClientSocketCommunicator |
getClientSocketCommunicator(TCPIPEventListener listener,
java.lang.String connectionProfile,
int communicatorId)
This method initialize comunicator and returns his instance. |
java.io.InputStream |
getInputStream()
Returns InputStream - for dates receipt. |
java.io.OutputStream |
getOutputStream()
Returns OutputStream - for dates sending. |
int |
openConnection(java.lang.String url)
opens connection to defined address |
void |
run()
Internal method - do not use it |
int |
setSocketOption(byte option,
int value)
Set TCP-IP comunication's parameters. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, checkAccess, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static int shortSleep
public static int longSleep
timeForSleep
public static int timeForSleep
public static final byte SOCKET_OPTION_DELAY
public static final byte SOCKET_OPTION_KEEPALIVE
public static final byte SOCKET_OPTION_LINGER
public static final byte SOCKET_OPTION_RCVBUF
public static final byte SOCKET_OPTION_SNDBUF
public static final int ERROR_CODE_ALL_OK
public static final int ERROR_CODE_CONNECTION_NOT_FOUND
public static final int ERROR_CODE_INVALID_PARAMETERS
public static final int ERROR_CODE_SECURITY_EXCEPTION
public static final int ERROR_CODE_IO_EXCEPTION
public static final int ERROR_CODE_UNKNOWN_ERROR
| Method Detail |
|---|
public static ClientSocketCommunicator getClientSocketCommunicator(TCPIPEventListener listener,
java.lang.String connectionProfile,
int communicatorId)
comunicatorId - - identification - if is used more active TCP-IP conectionslistener - TCPIPEventListenerconnectionProfile - conection parameters according to SIEMENS TC 65 documentation
public int setSocketOption(byte option,
int value)
openConnection(java.lang.String)
option - identifier of parameterSOCKET_OPTION_KEEPALIVESOCKET_OPTION_DELAYSOCKET_OPTION_LINGERSOCKET_OPTION_RCVBUFSOCKET_OPTION_SNDBUFvalue - value of parameter
public int openConnection(java.lang.String url)
url - address of server in form : 187.10.121.15:6050 or my.server.cz:5050
public java.io.OutputStream getOutputStream()
public java.io.InputStream getInputStream()
public int closeConnection()
public void run()
run in interface java.lang.Runnablerun in class java.lang.Thread
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||