C# Class BeardedManStudios.Network.ForgeMasterServer

Inheritance: UnityEngine.MonoBehaviour
Exibir arquivo Open project: drakelinglabs/unityarmada

Public Properties

Property Type Description
natComplete bool

Public Methods

Method Description
GetHosts ( string host, ushort pageNumber, Action callback ) : void

This method requests all of the hosts from the master server

PullNatRequest ( string ip, ushort port, ushort internalPort, string requestHost, ushort requestPort ) : void

This method is used on the server to attempt to connect through the NAT hole punch server to the client

RegisterNat ( CrossPlatformUDP socket, ushort port, string proxyHost, ushort proxyPort = PORT ) : void

This method is used to allow a server to register itself with the NAT hole punching server

RegisterNatRequest ( string ip, ushort port, ushort internalPort ) : void
RegisterServer ( string host, ushort port, int maxPlayers, string name, string gameType = "", string comment = "", string password = "", string sceneName = "" ) : void

This method is used to register a server to the master server to be retreived by clients

RequestNat ( CrossPlatformUDP socket, ushort port, string requestHost, ushort requestPort, string proxyHost, ushort proxyPort = PORT ) : bool

This method is used on the client to attempt to connect to the server through the NAT hole punch server

SetIp ( string ip ) : void
UnRegisterServer ( string host, ushort port ) : void

This method is used to manually unregister a server. If a server aborts the master server will automatically remove it

UpdateServer ( string host, ushort port, int playerCount ) : void

This method is used to update the current player count on the master server for this server

Private Methods

Method Description
Awake ( ) : void
GetHostsRequestToClient ( NetworkingPlayer sender, NetworkingStream stream ) : void
GetHostsRequestToServer ( NetworkingPlayer sender, NetworkingStream stream ) : void
OnApplicationQuit ( ) : void
PingHosts ( ) : void
PingRecieved ( string ip ) : void
RegisterServerRequest ( NetworkingPlayer sender, NetworkingStream stream ) : void
Request ( string host, Action call ) : void
Start ( ) : void
StartServer ( ) : void

This method is called when the host server button is clicked

UnRegisterServerRequest ( NetworkingPlayer sender, NetworkingStream stream ) : void
UpdateServerRequest ( NetworkingPlayer sender, NetworkingStream stream ) : void

Method Details

GetHosts() public static method

This method requests all of the hosts from the master server
public static GetHosts ( string host, ushort pageNumber, Action callback ) : void
host string The host of the master server
pageNumber ushort This is the page number (starting from 0). So if you want to get entries 0-n then you will pass 0, if you want n-n+n then pass 1
callback Action This is the method that will be called once the master server responds with the host list
return void

PullNatRequest() public method

This method is used on the server to attempt to connect through the NAT hole punch server to the client
public PullNatRequest ( string ip, ushort port, ushort internalPort, string requestHost, ushort requestPort ) : void
ip string This is the ip address of the NAT hole punch server
port ushort This is the port number of the NAT hole punch server
internalPort ushort This is the internal port of the client that this server is trying to communicate with
requestHost string This is the client host address that this server is trying to communicate with
requestPort ushort This is the client port number that this server is trying to communicate with
return void

RegisterNat() public static method

This method is used to allow a server to register itself with the NAT hole punching server
public static RegisterNat ( CrossPlatformUDP socket, ushort port, string proxyHost, ushort proxyPort = PORT ) : void
socket CrossPlatformUDP This is the socket that is being used for the communication with the clients
port ushort The port number that is being used for this server
proxyHost string The ip address of the the NAT hole punching (router) server
proxyPort ushort The port number for the NAT hole punch server
return void

RegisterNatRequest() public method

public RegisterNatRequest ( string ip, ushort port, ushort internalPort ) : void
ip string
port ushort
internalPort ushort
return void

RegisterServer() public static method

This method is used to register a server to the master server to be retreived by clients
public static RegisterServer ( string host, ushort port, int maxPlayers, string name, string gameType = "", string comment = "", string password = "", string sceneName = "" ) : void
host string The master server host address
port ushort The port that this server will be running on
maxPlayers int The maximum amount of players allowed on this server
name string The name for this server
gameType string The type of game for this server (ie. deathmatch, capture the flag, etc.)
comment string The comment for this server (usually user populated for loading screens)
password string The password for this server
sceneName string The scene name that this server is currently on
return void

RequestNat() public static method

This method is used on the client to attempt to connect to the server through the NAT hole punch server
public static RequestNat ( CrossPlatformUDP socket, ushort port, string requestHost, ushort requestPort, string proxyHost, ushort proxyPort = PORT ) : bool
socket CrossPlatformUDP This is the socket that is being used for the communication with the server
port ushort This is the port number that this client is bound to
requestHost string This is the host address of the server that this client is trying to connect to
requestPort ushort This is the host port of the server that this client is trying to connect to
proxyHost string This is the NAT hole punch server host address
proxyPort ushort This is the NAT hole punch server port number
return bool

SetIp() public static method

public static SetIp ( string ip ) : void
ip string
return void

UnRegisterServer() public static method

This method is used to manually unregister a server. If a server aborts the master server will automatically remove it
public static UnRegisterServer ( string host, ushort port ) : void
host string The host of the master server
port ushort The port that this server was running on
return void

UpdateServer() public static method

This method is used to update the current player count on the master server for this server
public static UpdateServer ( string host, ushort port, int playerCount ) : void
host string The host of the master server
port ushort The port number that this server is running on
playerCount int The current player count for this server
return void

Property Details

natComplete public_oe static_oe property

public static bool natComplete
return bool