Interface to a communication connection. More...
Public Member Functions | |
void | Close () |
Closes a connection. More... | |
void | Open () |
Opens a connection. More... | |
byte[] | Read () |
Read all bytes available. More... | |
void | Read (BinaryWriter binDataIn) |
Reads all bytes available into the stream passed in. More... | |
void | WaitForData (int msTimeOut) |
Waits until data available BytesAvailable in current thread. Current thread sleeps until data received or timeout reached. Blocking call. More... | |
void | Write (BinaryReader binReader) |
Write from input stream to output stream More... | |
void | Write (byte[] dataOut) |
Writes all bytes from the array passed in. More... | |
void | WriteAndWaitForResponse (BinaryWriter binDataIn, BinaryReader binDataOut, int responseStartTimeOut, int responseEndTimeOut, string completetionToken) |
Write binDataOut stream data to output stream and return data received in binDataIn stream. Data returned is any data received or up to completion token if received. Wait for response timeout before returning. More... | |
byte[] | WriteAndWaitForResponse (byte[] dataOut, int responseStartTimeOut, int responseEndTimeOut, string completetionToken) |
Write byte data to output stream and return data received. Data returned is any data received or up to completion token if received. Wait for response timeout before returning. More... | |
Interface to a communication connection.
Should add use of "Pipes" for more efficient I/O operations. e.g. "demultiplexer" (single input to multiple outputs) for input to have multiple "listeners" to data received.
void Close | ( | ) |
Closes a connection.
Implemented in AComm, and TcpConnection.
void Open | ( | ) |
Opens a connection.
Implemented in AComm, and TcpConnection.
byte[] Read | ( | ) |
Read all bytes available.
Implemented in AComm, and TcpConnection.
void Read | ( | BinaryWriter | binDataIn | ) |
Reads all bytes available into the stream passed in.
Implemented in AComm.
void WaitForData | ( | int | msTimeOut | ) |
Waits until data available BytesAvailable in current thread. Current thread sleeps until data received or timeout reached. Blocking call.
[in] | msTimeOut | Millisecond timeout before return if no data received. |
Implemented in AComm.
void Write | ( | BinaryReader | binReader | ) |
Write from input stream to output stream
[in] | binReader | Source data to send |
Implemented in AComm.
void Write | ( | byte[] | dataOut | ) |
Writes all bytes from the array passed in.
Implemented in AComm, and TcpConnection.
void WriteAndWaitForResponse | ( | BinaryWriter | binDataIn, |
BinaryReader | binDataOut, | ||
int | responseStartTimeOut, | ||
int | responseEndTimeOut, | ||
string | completetionToken | ||
) |
Write binDataOut stream data to output stream and return data received in binDataIn stream. Data returned is any data received or up to completion token if received. Wait for response timeout before returning.
[out] | binDataIn | Destination stream to store response received from connection. |
[in] | binDataOut | Source stream data to write to connection. |
[in] | responseStartTimeOut | Timeout to wait for first data to be received. Time to first byte. |
[in] | responseEndTimeOut | Timeout of no new data received. Time after last byte. |
[in] | completetionToken | String token denoting the end of the response expected. This can be empty string if simply want to wait for response after writng data to connection. |
Implemented in AComm.
byte[] WriteAndWaitForResponse | ( | byte[] | dataOut, |
int | responseStartTimeOut, | ||
int | responseEndTimeOut, | ||
string | completetionToken | ||
) |
Write byte data to output stream and return data received. Data returned is any data received or up to completion token if received. Wait for response timeout before returning.
byte[] | Array of bytes received from connection. Data returned is any data received or up to completetionToken if token received |
[in] | dataOut | Source byte array to write to connection. |
[in] | responseStartTimeOut | Timeout to wait for first data to be received. Time to first byte. |
[in] | responseEndTimeOut | Timeout of no new data received. Time after last byte. |
[in] | completetionToken | String token denoting the end of the response expected. This can be empty string if simply want to wait for response after writng data to connection. |
Implemented in AComm.