|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.yura.mobile.io.SocketClient
public abstract class SocketClient
Field Summary | |
---|---|
static int |
COMMUNICATING
|
protected javax.microedition.io.StreamConnection |
conn
|
static int |
CONNECTED
|
static int |
CONNECTING
|
static int |
DISCONNECTED
|
static int |
DISCONNECTED_AND_PAUSED
|
protected InputStream |
in
|
protected int |
initialWaitValue
|
protected int |
maxRetries
|
protected int |
maxWaitTimeMillis
|
protected Vector |
offlineBox
not sure how useful this is, as sometimes write does NOT throw any exception when trying to send something, even though it was not able to send, and the connection is shut down right after, that message would have been lost, and will not end up in the offline inbox |
protected OutputStream |
out
|
(package private) boolean |
pauseReconnectOnFailure
|
protected String |
protocol
|
protected int |
retryWaitMultiplier
|
protected QueueProcessorThread |
writeThread
|
Constructor Summary | |
---|---|
SocketClient(String server)
you can pass null into this method, but then you need to Override getNextServer() |
|
SocketClient(String server,
int maxRetries,
int retryWaitMultiplier,
int initialWaitValue,
int maxWaitTimeMillis,
boolean pauseReconnectOnFailure)
|
Method Summary | |
---|---|
void |
addToOfflineBox(Object t)
if we are in the DISCONNECTED_AND_PAUSED state, wake us up |
void |
addToOutbox(Object obj)
|
protected abstract void |
connected(InputStream in,
OutputStream out)
this method is called when a connection is established |
void |
disconnect()
|
protected abstract void |
disconnected()
This method is called when a connection is lost this should send a new message if you want to make a connection again the message you send will be something like 'hello' or 'login' |
protected int |
getMaxRetries()
|
protected String |
getNextServer()
|
Vector |
getOfflineBox()
|
protected int |
getRetryCount()
|
protected abstract void |
handleObject(Object task)
this is called when a object is recieved from the server |
protected javax.microedition.io.StreamConnection |
openConnection(String serv)
|
protected abstract Object |
read(InputStream in)
|
void |
run()
This is the run() method of the Socket read thread this thread can sometimes block and stick around even after a socket is closed and a new one reopened |
protected void |
securityException()
|
protected void |
sendOfflineInboxMessages()
|
void |
setDisconnected(boolean b)
|
void |
setRetryCount(int retryCount)
|
protected abstract void |
updateState(int c)
this is used to update a connection indicator |
void |
wake()
if we are in the DISCONNECTED_AND_PAUSED state, wake us up |
protected abstract void |
write(OutputStream out,
Object object)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int COMMUNICATING
protected javax.microedition.io.StreamConnection conn
public static final int CONNECTED
public static final int CONNECTING
public static final int DISCONNECTED
public static final int DISCONNECTED_AND_PAUSED
protected InputStream in
protected int initialWaitValue
protected int maxRetries
protected int maxWaitTimeMillis
protected Vector offlineBox
protected OutputStream out
boolean pauseReconnectOnFailure
protected String protocol
protected int retryWaitMultiplier
protected QueueProcessorThread writeThread
Constructor Detail |
---|
public SocketClient(String server)
getNextServer()
server
- public SocketClient(String server, int maxRetries, int retryWaitMultiplier, int initialWaitValue, int maxWaitTimeMillis, boolean pauseReconnectOnFailure)
Method Detail |
---|
public void addToOfflineBox(Object t)
public void addToOutbox(Object obj)
protected abstract void connected(InputStream in, OutputStream out)
public void disconnect()
protected abstract void disconnected()
protected int getMaxRetries()
protected String getNextServer()
public Vector getOfflineBox()
protected int getRetryCount()
protected abstract void handleObject(Object task)
protected javax.microedition.io.StreamConnection openConnection(String serv) throws IOException
IOException
protected abstract Object read(InputStream in) throws IOException
IOException
public final void run()
run
in interface Runnable
protected void securityException()
protected void sendOfflineInboxMessages()
public void setDisconnected(boolean b)
public void setRetryCount(int retryCount)
protected abstract void updateState(int c)
public void wake()
protected abstract void write(OutputStream out, Object object) throws IOException
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |