|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.ac.ic.doc.automed.p2p.communication.AbstractClient
public abstract class AbstractClient
| Field Summary | |
|---|---|
protected boolean |
ackExpected
|
protected byte[] |
dataToSend
|
protected RequestListener |
handler
|
protected boolean |
isReady
|
protected java.lang.String |
serverHostName
|
protected int |
serverPort
|
| Constructor Summary | |
|---|---|
AbstractClient(RequestListener handler)
Create a client with no fixed specification of destination hosts |
|
AbstractClient(java.lang.String serverHostName,
int serverPort,
RequestListener handler)
|
|
AbstractClient(java.lang.String serverHostName,
int serverPort,
RequestListener handler,
byte[] dataToSend)
|
|
| Method Summary | |
|---|---|
RequestListener |
getHandlerObject()
Return reference to RequestListener (handler) object |
boolean |
getReadyState()
Always true |
abstract void |
handleAction()
Handle thread's interrupted action |
abstract void |
runAction()
Implement communication process |
void |
setDataToSend(java.lang.String serverHostName,
int serverPort,
byte[] dataToSend,
boolean ackExpected)
Set the data to send (with acknowledgement specified). |
protected void |
setReadyState(boolean state)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String serverHostName
protected int serverPort
protected RequestListener handler
protected byte[] dataToSend
protected boolean ackExpected
protected boolean isReady
| Constructor Detail |
|---|
public AbstractClient(RequestListener handler)
public AbstractClient(java.lang.String serverHostName,
int serverPort,
RequestListener handler)
public AbstractClient(java.lang.String serverHostName,
int serverPort,
RequestListener handler,
byte[] dataToSend)
| Method Detail |
|---|
public void setDataToSend(java.lang.String serverHostName,
int serverPort,
byte[] dataToSend,
boolean ackExpected)
This method is used for clients which need to send messages to different
targets at different times. An example would be a messaging client of a peer
that needs to answer requests coming from different peers on the network.
serverHostName - address of remote host to sendserverPort - port on remote hostdataToSend - an array of bytes to send via UDPackExpected - whether or not to expect an acknowledgementpublic boolean getReadyState()
getReadyState in interface Threadableprotected void setReadyState(boolean state)
public RequestListener getHandlerObject()
RequestListener (handler) object
public abstract void runAction()
throws AutoMedException
runAction in interface ThreadableAutoMedExceptionpublic abstract void handleAction()
handleAction in interface Threadable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||