|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--comm2j.Comm2J
Comm2j is a class used to communicate with a Server (J2ME or J2SE), transmitting
and receiving Messages.
It uses Read2J to communicate with the Server. Comm2J runs only on J2ME.
On J2SE you need to use just the Read2J.
MessageI
,
Read2J
Constructor Summary | |
Comm2J(javax.microedition.lcdui.CommandListener cmdListener,
javax.microedition.lcdui.Display display,
java.lang.String host,
java.lang.String port)
Constructor. Save the connection data. |
|
Comm2J(javax.microedition.lcdui.CommandListener cmdListener,
javax.microedition.lcdui.Display display,
java.lang.String host,
java.lang.String port,
int mode)
Constructor. Save the connection data. |
Method Summary | |
void |
connect()
Connect to the remote host. |
void |
disconnect()
Disconnect from the remote host. |
javax.microedition.lcdui.CommandListener |
getCommandListener()
Returns the CommandListener used by Comm2J |
javax.microedition.io.Connection |
getConnection()
Returns the connection link to the remote host ot null if not yet initialized. |
javax.microedition.lcdui.Display |
getDisplay()
Returns the display used by Comm2J |
java.lang.String |
getHost()
Returns the host used by Comm2j |
int |
getMode()
Returns the mode used by Comm2J for the communication with the server |
java.lang.String |
getPort()
Returns the port used by Comm2j |
boolean |
isConnected()
Used to know if Comm2J has a valid link to the remote host |
Message |
readMessageFromStream()
Receive a message from the remote host. |
void |
setCommandListener(javax.microedition.lcdui.CommandListener cmdListener)
Sets the CommandListener used by Comm2J |
void |
setDisplay(javax.microedition.lcdui.Display display)
Sets the display to be used by Comm2J |
void |
setHost(java.lang.String host)
Sets the host used by Comm2j |
void |
setMode(int mode)
Sets the mode used by Comm2J for the communication with the server |
void |
setPort(java.lang.String port)
Sets the port used by Comm2j |
int |
writeMessageToStream(Message msg)
Send a message to the remote host. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Comm2J(javax.microedition.lcdui.CommandListener cmdListener, javax.microedition.lcdui.Display display, java.lang.String host, java.lang.String port)
cmdListener
- CommandListener to be used to send commandsdisplay
- Display to be used to show datahost
- Host to connect toport
- Port on the Host to connect topublic Comm2J(javax.microedition.lcdui.CommandListener cmdListener, javax.microedition.lcdui.Display display, java.lang.String host, java.lang.String port, int mode)
cmdListener
- CommandListener to be used to send commandsdisplay
- Display to be used to show datahost
- Host to connect toport
- Port on the Host to connect tomode
- Communication mode (RAW or COMPRESSED)Method Detail |
public javax.microedition.lcdui.CommandListener getCommandListener()
public void setCommandListener(javax.microedition.lcdui.CommandListener cmdListener)
cmdListener
- New CommandListener to be usedpublic javax.microedition.lcdui.Display getDisplay()
public void setDisplay(javax.microedition.lcdui.Display display)
display
- New display to be used to show datapublic int getMode()
Read2J
public void setMode(int mode)
mode
- New communication mode to be usedRead2J
public java.lang.String getHost()
public void setHost(java.lang.String host)
host
- New host to connect topublic java.lang.String getPort()
public void setPort(java.lang.String port)
port
- New port on the Host to connect topublic javax.microedition.io.Connection getConnection()
public void connect()
public boolean isConnected()
public void disconnect()
public int writeMessageToStream(Message msg)
msg
- Message to be sentpublic Message readMessageFromStream()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |