|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmegamek.common.net.AbstractConnection
megamek.common.net.DataStreamConnection
class DataStreamConnection
Implementation of the Connection that uses the
DataInputStream and DataOutputStream to
send/receive data.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class megamek.common.net.AbstractConnection |
|---|
AbstractConnection.INetworkPacket, AbstractConnection.SendQueue |
| Field Summary | |
|---|---|
protected int |
encoding
|
protected int |
len
|
protected PacketReadState |
state
|
protected boolean |
zipped
store data for packet reception statemachine |
| Fields inherited from class megamek.common.net.AbstractConnection |
|---|
bytesSent, marshaller, marshallingType, zipData |
| Constructor Summary | |
|---|---|
DataStreamConnection(java.net.Socket socket,
int id)
Creates new server connection |
|
DataStreamConnection(java.lang.String host,
int port,
int id)
Creates new Client connection |
|
| Method Summary | |
|---|---|
void |
flush()
override flush to flush the datastream after flushing packetqueue |
protected AbstractConnection.INetworkPacket |
readNetworkPacket()
Reads a complete NetworkPacket must not block, must return
null instead |
protected void |
sendNetworkPacket(byte[] data,
boolean iszipped)
Sends the data must not block for too long |
| Methods inherited from class megamek.common.net.AbstractConnection |
|---|
addConnectionListener, bytesReceived, bytesSent, close, doFlush, getConnectionTypeAbbrevation, getId, getInetAddress, getInputStream, getMarshallingType, getOutputStream, hasPending, isCompressed, isServer, open, processConnectionEvent, processPacket, processPacket, removeConnectionListener, reportLastCommands, reportLastCommands, reportReceiveException, reportReceiveException, reportSendException, send, sendNow, setCompression, setId, setMarshallingType, update |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean zipped
protected int encoding
protected int len
protected PacketReadState state
| Constructor Detail |
|---|
public DataStreamConnection(java.net.Socket socket,
int id)
socket - id -
public DataStreamConnection(java.lang.String host,
int port,
int id)
host - port - id - | Method Detail |
|---|
protected AbstractConnection.INetworkPacket readNetworkPacket()
throws java.lang.Exception
AbstractConnectionNetworkPacket must not block, must return
null instead
readNetworkPacket in class AbstractConnectionNetworkPacket that was sent.
java.lang.Exception
protected void sendNetworkPacket(byte[] data,
boolean iszipped)
throws java.lang.Exception
AbstractConnection
sendNetworkPacket in class AbstractConnectiondata - data to sendiszipped - should the data be compressed
java.lang.Exceptionpublic void flush()
flush in interface IConnectionflush in class AbstractConnection
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||