C# Class NewTOAPIA.Net.UdpReceiver

Inheritance: IReceiveBufferChunk, IDisposable
Show file Open project: Wiladams/NewTOAPIA Class Usage Examples

Public Methods

Method Description
AsyncReceiveFrom ( Queue queueOfBufferChunks, ReceivedFromCallback callback ) : void
Dispose ( ) : void

Dispose per the IDisposable pattern

Receive ( BufferChunk packetBuffer ) : void

Receive a packet into a BufferChunk. This method is preferred over receiving into a byte[] because you can allocate a large byte[] in one BufferChunk and continously receive into the buffer without recreating byte[]s and dealing with the memory allocation overhead that causes. The number of bytes received is stored in BufferChunk.Length.

ReceiveFrom ( BufferChunk packetBuffer, EndPoint &endPoint ) : void

Same as Receive, but you also get an EndPoint containing the sender of the packet.

UdpReceiver ( IPEndPoint endPoint, int timeoutMilliseconds ) : System

Constructor that binds this object instance to an IPEndPoint. If you need to change IPEndPoint dynamically, Dispose and recreate a new object.

Private Methods

Method Description
asyncReceiveCallback ( IAsyncResult ar ) : void

Method Details

AsyncReceiveFrom() public method

public AsyncReceiveFrom ( Queue queueOfBufferChunks, ReceivedFromCallback callback ) : void
queueOfBufferChunks Queue
callback ReceivedFromCallback
return void

Dispose() public method

Dispose per the IDisposable pattern
public Dispose ( ) : void
return void

Receive() public method

Receive a packet into a BufferChunk. This method is preferred over receiving into a byte[] because you can allocate a large byte[] in one BufferChunk and continously receive into the buffer without recreating byte[]s and dealing with the memory allocation overhead that causes. The number of bytes received is stored in BufferChunk.Length.
public Receive ( BufferChunk packetBuffer ) : void
packetBuffer BufferChunk BufferChunk
return void

ReceiveFrom() public method

Same as Receive, but you also get an EndPoint containing the sender of the packet.
public ReceiveFrom ( BufferChunk packetBuffer, EndPoint &endPoint ) : void
packetBuffer BufferChunk BufferChunk
endPoint System.Net.EndPoint EndPoint
return void

UdpReceiver() public method

Constructor that binds this object instance to an IPEndPoint. If you need to change IPEndPoint dynamically, Dispose and recreate a new object.
public UdpReceiver ( IPEndPoint endPoint, int timeoutMilliseconds ) : System
endPoint System.Net.IPEndPoint IPEndPoint where we should be listening for IP Multicast packets.
timeoutMilliseconds int
return System