C# Class Universe.ClientStack.UDPBase

Base UDP server
显示文件 Open project: Virtual-Universe/Virtual-Universe

Protected Properties

Property Type Description
m_localBindAddress System.Net.IPAddress
m_udpPort int

Public Methods

Method Description
Initialize ( IPAddress bindAddress, int port ) : void

Default Initialization

Start ( int recvBufferSize, bool asyncPacketHandling ) : void

Start the UDP server

This method will attempt to set the SIO_UDP_CONNRESET flag on the socket to get newer versions of Windows to behave in a sane manner (not throwing an exception when the remote side resets the connection). This call is ignored on Mono where the flag is not necessary

Stop ( ) : void

Stops the UDP server

SyncSend ( UDPPacketBuffer buf ) : void

Protected Methods

Method Description
PacketReceived ( UDPPacketBuffer buffer ) : void

This method is called when an incoming packet is received

Private Methods

Method Description
AsyncBeginReceive ( ) : void
AsyncEndReceive ( IAsyncResult iar ) : void

Method Details

Initialize() public method

Default Initialization
public Initialize ( IPAddress bindAddress, int port ) : void
bindAddress System.Net.IPAddress Local IP address to bind the server to
port int Port to listening for incoming UDP packets on
return void

PacketReceived() protected abstract method

This method is called when an incoming packet is received
protected abstract PacketReceived ( UDPPacketBuffer buffer ) : void
buffer UDPPacketBuffer Incoming packet buffer
return void

Start() public method

Start the UDP server
This method will attempt to set the SIO_UDP_CONNRESET flag on the socket to get newer versions of Windows to behave in a sane manner (not throwing an exception when the remote side resets the connection). This call is ignored on Mono where the flag is not necessary
public Start ( int recvBufferSize, bool asyncPacketHandling ) : void
recvBufferSize int /// The size of the receive buffer for /// the UDP socket. This value is passed up to the operating system /// and used in the system networking stack. Use zero to leave this /// value as the default ///
asyncPacketHandling bool /// Set this to true to start /// receiving more packets while current packet handler callbacks are /// still running. Setting this to false will complete each packet /// callback before the next packet is processed ///
return void

Stop() public method

Stops the UDP server
public Stop ( ) : void
return void

SyncSend() public method

public SyncSend ( UDPPacketBuffer buf ) : void
buf UDPPacketBuffer
return void

Property Details

m_localBindAddress protected_oe property

Local IP address to bind to in server mode
protected IPAddress,System.Net m_localBindAddress
return System.Net.IPAddress

m_udpPort protected_oe property

UDP port to bind to in server mode
protected int m_udpPort
return int