NetSamples.Common.Net
Class MessageConnection

A TcpConnection that exchanges message using a MessageReader and MessageWriter pair.

Field Summary
NetSamples.Common.IO.MessageReader reader
NetSamples.Common.Net.MessageConnection.ReceiveDelegate receiver
NetSamples.Common.Net.MessageConnection.SendDelegate sender
NetSamples.Common.IO.MessageWriter writer

Fields inherited from class NetSamples.Common.Net.TcpConnection
socket, stream

Constructor Summary
MessageConnection(System.Type[] messagetypes)
         Constructor
MessageConnection(System.Net.Sockets.Socket socket, System.Type[] messagetypes)
         Constructor

Properties inherited from class NetSamples.Common.Net.TcpConnection
Connected, LocalEndPoint, RemoteEndPoint

Method Summary
System.IAsyncResult BeginReceive(System.AsyncCallback callback, object state)
         Starts an asynchronous Receive
System.IAsyncResult BeginSend(object message, System.AsyncCallback callback, object state)
         Starts an asynchronous Send
void Close()
         Closes the connection
void Connect(System.Net.IPEndPoint endpoint)
         Connect to a remote endpoint
object EndReceive(System.IAsyncResult result)
         Ends an asynchronous Receive
void EndSend(System.IAsyncResult result)
         Ends an asynchronous Send
object Receive()
         Receives a message
void Send(object message)
         Sends a message

Methods inherited from class NetSamples.Common.Net.TcpConnection
GetStream, Receive, Send

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString


Field Detail

reader

protected NetSamples.Common.IO.MessageReader reader


receiver

private NetSamples.Common.Net.MessageConnection.ReceiveDelegate receiver


sender

private NetSamples.Common.Net.MessageConnection.SendDelegate sender


writer

protected NetSamples.Common.IO.MessageWriter writer

Constructor Detail

MessageConnection

public MessageConnection(System.Type[] messagetypes)

Constructor


MessageConnection

public MessageConnection(System.Net.Sockets.Socket socket,
                         System.Type[] messagetypes)

Constructor

Method Detail

BeginReceive

public System.IAsyncResult BeginReceive(System.AsyncCallback callback,
                                        object state)

Starts an asynchronous Receive


BeginSend

public System.IAsyncResult BeginSend(object message,
                                     System.AsyncCallback callback,
                                     object state)

Starts an asynchronous Send


Close

public void Close()

Closes the connection


Connect

public void Connect(System.Net.IPEndPoint endpoint)

Connect to a remote endpoint


EndReceive

public object EndReceive(System.IAsyncResult result)

Ends an asynchronous Receive


EndSend

public void EndSend(System.IAsyncResult result)

Ends an asynchronous Send


Receive

public object Receive()

Receives a message


Send

public void Send(object message)

Sends a message