support for listening on specific ip addresses and additional ports
This commit is contained in:
parent
36868afd0a
commit
a4c562c06d
5 changed files with 72 additions and 56 deletions
|
|
@ -14,8 +14,13 @@ namespace Server
|
|||
private const int CoalesceBufferSize = 512; // MSS that the core will use when buffering packets
|
||||
private const int PooledSockets = 32; // The number of sockets to initially pool. Ideal value is expected client count.
|
||||
|
||||
private static int[] m_AdditionalPorts = new int[0];
|
||||
//private static int[] m_AdditionalPorts = new int[]{ 2594 };
|
||||
private static IPEndPoint[] m_ListenerEndPoints = new IPEndPoint[] {
|
||||
new IPEndPoint( IPAddress.Any, 2593 ), // Default: Listen on port 2593 on all IP addresses
|
||||
|
||||
// Examples:
|
||||
// new IPEndPoint( IPAddress.Any, 80 ), // Listen on port 80 on all IP addresses
|
||||
// new IPEndPoint( IPAddress.Parse( "1.2.3.4" ), 2593 ), // Listen on port 2593 on IP address 1.2.3.4
|
||||
};
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
@ -24,14 +29,7 @@ namespace Server
|
|||
|
||||
EventSink.SocketConnect += new SocketConnectEventHandler( EventSink_SocketConnect );
|
||||
|
||||
if ( m_AdditionalPorts.Length > 0 )
|
||||
EventSink.ServerStarted += new ServerStartedEventHandler( EventSink_ServerStarted );
|
||||
}
|
||||
|
||||
public static void EventSink_ServerStarted()
|
||||
{
|
||||
for ( int i = 0; i < m_AdditionalPorts.Length; ++i )
|
||||
Core.MessagePump.AddListener( new Listener( m_AdditionalPorts[i] ) );
|
||||
Listener.EndPoints = m_ListenerEndPoints;
|
||||
}
|
||||
|
||||
private static void EventSink_SocketConnect( SocketConnectEventArgs e )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue