|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.emf.mwe.internal.core.debug.communication.Connection
public class Connection
This class implements a socket connection model. "Packages" (units of information) can be transfered between two different virtual machines. During the initialisation of a socket connection a reader and a writer thread are established. This class can be used both on the sender and receiver side.
| Constructor Summary | |
|---|---|
Connection()
|
|
| Method Summary | |
|---|---|
void |
accept(int timeout)
the server listens for a client to connect, creates new reader and writer threads and sends a first handshake packet to test the communication |
void |
close()
close and dispose the socket and the (possibly waiting) sender thread |
void |
connect(int port)
the client establishes the connection here, creates new reader and writer threads and waits for a handshake packet to be received from the server |
boolean |
isConnected()
|
AbstractPackage |
listenForPackage(java.lang.Class<? extends AbstractPackage> type)
|
AbstractPackage |
listenForPackage(java.lang.Class<? extends AbstractPackage> type,
int refId)
|
protected AbstractPackage |
readPackage()
|
int |
sendPackage(AbstractPackage packet)
|
void |
startListeningSocket(int port)
create a new ServerSocket. |
protected void |
writePackage(AbstractPackage packet)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Connection()
| Method Detail |
|---|
public AbstractPackage listenForPackage(java.lang.Class<? extends AbstractPackage> type)
throws java.io.InterruptedIOException
java.io.InterruptedIOException
public AbstractPackage listenForPackage(java.lang.Class<? extends AbstractPackage> type,
int refId)
throws java.io.InterruptedIOException
java.io.InterruptedIOException
public int sendPackage(AbstractPackage packet)
throws java.io.IOException
java.io.IOException
public void startListeningSocket(int port)
throws java.io.IOException
ServerSocket.
port - the communication port
java.io.IOException
public void accept(int timeout)
throws java.io.IOException
timeout -
java.io.IOException
public void connect(int port)
throws java.io.IOException
port -
java.io.IOExceptionpublic boolean isConnected()
public void close()
protected AbstractPackage readPackage()
throws java.io.IOException
java.io.IOException
protected void writePackage(AbstractPackage packet)
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||