Holds important information about the current network connection and additionally about INetworkMessage listeners.
More...
Holds important information about the current network connection and additionally about INetworkMessage listeners.
Add a new connection monitor listener. This allows for client code to be notified when another player connects or disconnects from the network.
- Parameters
-
monitor | The connection monitor to add. |
Adds the given message handler to the network context.
- Parameters
-
handler | The network message handler to add. |
static Maybe<NetworkContext> Forge.Networking.Core.NetworkContext.CreateClient |
( |
string |
ip, |
|
|
Player |
player, |
|
|
string |
password |
|
) |
| |
|
static |
Creates a new client connection connected to the given IP end point. This method blocks until we know if the client has either connected or disconnected.
- Parameters
-
ip | The IP to connect to. |
player | This computer's player. |
password | The password that the server is expecting. |
- Returns
static NetworkContext Forge.Networking.Core.NetworkContext.CreateServer |
( |
Player |
player, |
|
|
string |
password |
|
) |
| |
|
static |
Creates a new server.
- Parameters
-
player | The player that is running this server. |
password | The password that clients have to have to connect. |
- Returns
- A network context for the created server.
IEnumerable<IPAddress> Forge.Networking.Core.NetworkContext.GetServerIPs |
( |
| ) |
|
Tries to fetch all possible IPs that might be possible for clients to connect to the server with. This operation throws an exception if the context is not a server.
bool Forge.Networking.Core.NetworkContext.IsPlayerServer |
( |
Player |
player | ) |
|
Returns true if the given Player is the server.
- Parameters
-
player | The player to check. |
- Returns
- True if the player is the server, otherwise false.
void Forge.Networking.Core.NetworkContext.Kick |
( |
Player |
player | ) |
|
Kicks the given player. This function is only operable if the context is a server (otherwise an exception is thrown).
- Parameters
-
player | The player to kick. |
Remove a previously added connection monitor. If the monitor was not found when removing it, an exception is thrown.
- Parameters
-
monitor | The connection monitor to remove. |
Removes the given message handler from the context. If the dispatcher was not previously contained in the context, then an exception is thrown.
- Parameters
-
handler | The network message handler to remove. |
Send the given message to the given recipients.
- Parameters
-
recipient | The computers that should receive the message. |
message | The message to send. |
Send the given message to only the specified recipient.
- Parameters
-
recipient | The player that should receive the message. |
message | Who to send the message to. |
void Forge.Networking.Core.NetworkContext.Update |
( |
| ) |
|
Update the network context; ie, invoke handlers for received network messages if we're a client or broadcast out received messages if we're a server.
bool Forge.Networking.Core.NetworkContext.IsClient |
|
get |
bool Forge.Networking.Core.NetworkContext.IsServer |
|
get |
Returns true if this NetworkConext is acting as a server.
Player Forge.Networking.Core.NetworkContext.LocalPlayer |
|
getset |
The documentation for this class was generated from the following file:
- Forge.Networking/Core/NetworkContext.cs