BufferedSocket manages asynchronous communications via TCP/IP sockets and exposes events and methods that make it easier for application developers to reap the benefits of async. patterns with a simpler interface. This class is used internally by Munja.
The following tables list the members exposed by BufferedSocket.
Public Fields
| Name | Description | |
|---|---|---|
|
SendComplete | Synchronisation object for async. send operations |
Protected Fields
| Name | Description | |
|---|---|---|
|
recvTimer | Timer used to implement timeout on receiving data |
|
sendOffset | Current send position within buffer |
|
sendTimer | Timer used to implement timeout on sending data |
Public Properties
| Name | Description | |
|---|---|---|
|
BaseSocket | The .NET socket that this socket wraps |
|
CanSend | Is the socket ready to send more data? |
|
Closed | Indicates whether the socket has been closed |
|
ReceiveBuffer | Receive buffer |
|
ReceiveOffset | Current position within receive buffer |
|
Receiving | Internal use only |
|
SendBuffer | Buffer for sending data |
|
Sending | Indicates whether the socket is currently sending data |
|
SendMax | Maximum bytes to send |
|
Tag | User defined object to associate with socket |
|
TimedOut | Set when a timeout occurs |
|
TotalBytesReceived | Total bytes received through this socket |
|
TotalBytesSent | Total bytes sent through this socket |
Public Methods
| Name | Description | |
|---|---|---|
|
AsyncSend | Call this method to start sending data from the SendBuffer |
|
BeginReceive | Overloaded. Call this method to begin receiving data from the socket |
|
BeginSend | Call this method to send data asynchronously |
|
Equals | Determines whether the specified |
|
ExtractLineFromReceiveBuffer | For text based protocols such as HTTP, SMTP, POP3 this method will extract a text line from the binary buffer. |
|
ExtractLinesFromReceiveBuffer | Extracts text lines from a binary buffer until a blank line or the end of is encountered. |
|
GetHashCode | Serves as a hash function for a particular type. |
|
GetType | Gets the |
|
OnReceive | Internal event handler for async. result which then fires DataReceived |
|
OnSend | Handler for async. sending event. Will then fire SendCompleted when all the data in SendBuffer has been sent. |
|
Reset | Resets the socket ready for (re)use |
|
ShiftReceiveBuffer | Shifts the buffer after data has been extracted |
|
Shutdown | Shuts down all communications on this socket |
|
SyncSend | By default BufferedSocket uses the async. communications model but can be forced to send data synchronously by using this method. |
|
ToString | Returns a |
Protected Methods
| Name | Description | |
|---|---|---|
|
Finalize | Allows an |
|
MemberwiseClone | Creates a shallow copy of the current |
|
TraceWriteLine | Debug trace output |
Public Events
| Name | Description | |
|---|---|---|
|
DataReceived | This event is fired when data is received on the socket |
|
SendCompleted | This event is fired once all the data in the send buffer has been sent |