|
jAER project on SourceForge | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jaer.eventio.AESocket
public class AESocket
Streams in or out packets of events from or to a stream socket network connection over a reliable TCP connection.
Stream format is very simple:
int32 address0 int32 timestamp0 int32 address1 int32 timestamp1 etc for n AEs.The timestamp tick is us. The addresses are raw device addresses. See the AEChip classes for their EventExtractor2D inner class extractor definitions for individual device address formats.
Nested Class Summary | |
---|---|
class |
AESocket.NonMonotonicTimeException
class used to signal a backwards read from input stream |
class |
AESocket.WrappedTimeException
|
Field Summary | |
---|---|
static int |
CONNECTION_TIMEOUT_MS
timeout in ms for connection attempts |
static int |
DEFAULT_BUFFERED_STREAM_SIZE_BYTES
|
static int |
DEFAULT_RECEIVE_BUFFER_SIZE_BYTES
|
static int |
DEFAULT_SEND_BUFFER_SIZE_BYTES
|
int |
MAX_NONMONOTONIC_TIME_EXCEPTIONS_TO_PRINT
|
static int |
MAX_PACKET_SIZE_EVENTS
|
static int |
SO_TIMEOUT
timeout in ms for read/write attempts |
Constructor Summary | |
---|---|
AESocket()
|
|
AESocket(java.net.Socket s)
Creates a new instance of AESocket using an existing Socket. |
|
AESocket(java.lang.String host,
int port)
Creates a new instance of AESocket for connection to the host:port. |
Method Summary | |
---|---|
void |
close()
Closes the AESocket and nulls the data input and output streams |
void |
connect()
Connects to the socket, using the specified host and port specified in the constructor |
int |
getBufferedStreamSize()
|
java.lang.String |
getHost()
|
static java.lang.String |
getLastHost()
|
int |
getMostRecentTimestamp()
|
int |
getPort()
|
int |
getReceiveBufferSize()
|
int |
getSendBufferSize()
|
java.net.Socket |
getSocket()
returns the underlying Socket |
boolean |
isConnected()
Is this socket connected. |
boolean |
isFlushPackets()
|
boolean |
isUseBufferedStreams()
|
AEPacketRaw |
readPacket()
returns events from AESocket. |
void |
setBufferedStreamSize(int sizeBytes)
|
void |
setFlushPackets(boolean flushPackets)
|
void |
setHost(java.lang.String host)
Sets the preferred host:port string. |
void |
setMostRecentTimestamp(int mostRecentTimestamp)
|
void |
setPort(int port)
|
void |
setReceiveBufferSize(int sizeBytes)
|
void |
setSendBufferSize(int sizeBytes)
|
void |
setUseBufferedStreams(boolean useBufferedStreams)
|
java.lang.String |
toString()
|
void |
writePacket(AEPacketRaw p)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_RECEIVE_BUFFER_SIZE_BYTES
public static final int DEFAULT_SEND_BUFFER_SIZE_BYTES
public static final int DEFAULT_BUFFERED_STREAM_SIZE_BYTES
public static final int CONNECTION_TIMEOUT_MS
public static final int SO_TIMEOUT
public final int MAX_NONMONOTONIC_TIME_EXCEPTIONS_TO_PRINT
public static final int MAX_PACKET_SIZE_EVENTS
Constructor Detail |
---|
public AESocket(java.net.Socket s) throws java.io.IOException
s
- the socket to use.
java.io.IOException
public AESocket(java.lang.String host, int port)
connect()
, options can be set on the socket like the buffer size
.
host
- to connect to. Can have format host:port. If port is omitted, it defaults to AENetworkInterface.PORT.connect()
public AESocket()
Method Detail |
---|
public void setReceiveBufferSize(int sizeBytes)
public void setSendBufferSize(int sizeBytes)
public void setBufferedStreamSize(int sizeBytes)
public int getReceiveBufferSize()
public int getSendBufferSize()
public int getBufferedStreamSize()
public AEPacketRaw readPacket() throws java.io.IOException
java.io.IOException
public void writePacket(AEPacketRaw p) throws java.io.IOException
java.io.IOException
public int getMostRecentTimestamp()
public void setMostRecentTimestamp(int mostRecentTimestamp)
public void close() throws java.io.IOException
java.io.IOException
public java.lang.String getHost()
public void setHost(java.lang.String host)
public int getPort()
public void setPort(int port)
public static java.lang.String getLastHost()
public java.lang.String toString()
toString
in class java.lang.Object
public java.net.Socket getSocket()
public void connect() throws java.io.IOException
java.io.IOException
- if underlying socket cannot connectpublic boolean isUseBufferedStreams()
public void setUseBufferedStreams(boolean useBufferedStreams)
public boolean isFlushPackets()
public void setFlushPackets(boolean flushPackets)
public boolean isConnected()
|
jAER project on SourceForge | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |