C# Class BF2Statistics.Gamespy.MasterServer

Master.Gamespy.com Server. Alot of code was borrowed and re-written from the Open Source PRMasterServer located here: https://github.com/AncientMan2002/PRMasterServer
Inheritance: GamespyUdpSocket
Mostra file Open project: BF2Statistics/ControlCenter Class Usage Examples

Public Properties

Property Type Description
Servers GameServer>.ConcurrentDictionary

Public Methods

Method Description
MasterServer ( int &Port, LogWriter DebugLog ) : System
Shutdown ( ) : void

Shutsdown the Master server and socket

Protected Methods

Method Description
ProcessAccept ( GamespyUdpPacket Packet ) : void

Callback method for when the UDP Master socket recieves a connection

Private Methods

Method Description
CheckServers ( ) : void

Executed every 5 seconds or so... Removes all servers that haven't reported in awhile, assuming they are offline

ParseServerDetails ( IPEndPoint remote, byte data ) : bool

Executed every 60 seconds per server (Every 3rd ping), the BF2 server sends a full list of data that describes its current state, and this method is used to parse that data, and update the server in the Servers list

ValidateServer ( IPEndPoint remote ) : bool

When a server sends data initially, it needs to be validated with a validation code. Once that has happened, this method is called, and it allows the server to be seen in the Serverlist. This method also corrects local IP addresses by converting them to External IP addresses, so that external clients get a good IP to connect to.

Method Details

MasterServer() public method

public MasterServer ( int &Port, LogWriter DebugLog ) : System
Port int
DebugLog BF2Statistics.Logging.LogWriter
return System

ProcessAccept() protected method

Callback method for when the UDP Master socket recieves a connection
protected ProcessAccept ( GamespyUdpPacket Packet ) : void
Packet BF2Statistics.Gamespy.Net.GamespyUdpPacket
return void

Shutdown() public method

Shutsdown the Master server and socket
public Shutdown ( ) : void
return void

Property Details

Servers public_oe static_oe property

A List of all servers that have sent data to this master server, and are active in the last 30 seconds or so
public static ConcurrentDictionary Servers
return GameServer>.ConcurrentDictionary