Show / Hide Table of Contents

Class NetworkClient

Inheritance
System.Object
NetworkClient
Implements
System.IDisposable
Namespace: Eco.Shared.Networking
Assembly: Eco.Shared.dll
Syntax
public sealed class NetworkClient : Object, IDisposable

Constructors

NetworkClient(IUdpLibrary)

Declaration
public NetworkClient(IUdpLibrary udpLibrary)
Parameters
Type Name Description
IUdpLibrary udpLibrary

Fields

BigMessageIncoming

Declaration
public SubscribableEvent<Action<(byte, int, int, LocString)>> BigMessageIncoming
Field Value
Type Description
SubscribableEvent<System.Action<System.ValueTuple<System.Byte, System.Int32, System.Int32, LocString>>>

EnqueuedPackets

Declaration
[ClientAPI]
public int EnqueuedPackets
Field Value
Type Description
System.Int32

OfficialServerDiscovered

Declaration
public SubscribableEvent<Action<StrangeWorld>> OfficialServerDiscovered
Field Value
Type Description
SubscribableEvent<System.Action<StrangeWorld>>

OnConnected

Declaration
public SubscribableEvent<Action> OnConnected
Field Value
Type Description
SubscribableEvent<System.Action>

OnDisconnected

Declaration
public SubscribableEvent<Action<string, bool>> OnDisconnected
Field Value
Type Description
SubscribableEvent<System.Action<System.String, System.Boolean>>

QueuesCount

Declaration
[ClientAPI]
public readonly int QueuesCount
Field Value
Type Description
System.Int32

ReceivedMessage

Declaration
public SubscribableEvent<Action> ReceivedMessage
Field Value
Type Description
SubscribableEvent<System.Action>

ServerDiscovered

Declaration
public SubscribableEvent<Action<StrangeWorld>> ServerDiscovered
Field Value
Type Description
SubscribableEvent<System.Action<StrangeWorld>>

Properties

Ping

Declaration
public int Ping { get; }
Property Value
Type Description
System.Int32

RemoteEndPoint

Actual remote end-point for the Eco.Shared.Networking.NetworkClient.peer.

Declaration
public IPEndPoint RemoteEndPoint { get; }
Property Value
Type Description
System.Net.IPEndPoint

ServerEndPoint

Server's original end-point (may differ from RemoteEndPoint if connected with relay).

Declaration
public IPEndPoint ServerEndPoint { get; }
Property Value
Type Description
System.Net.IPEndPoint

Status

Declaration
public UdpConnectionStatus Status { get; }
Property Value
Type Description
UdpConnectionStatus

Methods

Connect(StrangeWorld)

Declaration
public void Connect(StrangeWorld world)
Parameters
Type Name Description
StrangeWorld world

Connect(Guid)

Declaration
public void Connect(Guid serverId)
Parameters
Type Name Description
System.Guid serverId

Connect(IPEndPoint)

Declaration
public bool Connect(IPEndPoint endPoint)
Parameters
Type Name Description
System.Net.IPEndPoint endPoint
Returns
Type Description
System.Boolean

Connect(String, Int32)

Declaration
public bool Connect(string address, int port)
Parameters
Type Name Description
System.String address
System.Int32 port
Returns
Type Description
System.Boolean

Disconnect(String, Boolean)

Declaration
public void Disconnect(string byeMessage = null, bool causedByError = false)
Parameters
Type Name Description
System.String byeMessage
System.Boolean causedByError

DiscoverLocalServers()

Declaration
public void DiscoverLocalServers()

Dispose()

Disposes of the System.ComponentModel.Component.

Declaration
public void Dispose()

Dispose(Boolean)

Declaration
public void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

Finalize()

Declaration
protected override void Finalize()

GetConnectionStats()

Declaration
public NetStats GetConnectionStats()
Returns
Type Description
NetStats

GetRawServerName()

Declaration
public string GetRawServerName()
Returns
Type Description
System.String

GetServerInfo(Guid)

Declaration
public Task GetServerInfo(Guid serverID)
Parameters
Type Name Description
System.Guid serverID
Returns
Type Description
System.Threading.Tasks.Task

GetServerInfo(IPEndPoint)

Declaration
public void GetServerInfo(IPEndPoint endPoint)
Parameters
Type Name Description
System.Net.IPEndPoint endPoint

GetServerInfo(String, Int32)

Declaration
public void GetServerInfo(string address, int serverPort)
Parameters
Type Name Description
System.String address
System.Int32 serverPort

GetServerName()

Declaration
public string GetServerName()
Returns
Type Description
System.String

HandleDisconnect(String)

Declaration
public void HandleDisconnect(string reason)
Parameters
Type Name Description
System.String reason

SendEvent(NetworkEvent, BSONValue)

Declaration
public void SendEvent(NetworkEvent netEvent, BSONValue bson)
Parameters
Type Name Description
NetworkEvent netEvent
BSONValue bson

SendPingRequest(StrangeWorld)

Declaration
public NetworkClient.PingRequest SendPingRequest(StrangeWorld world)
Parameters
Type Name Description
StrangeWorld world
Returns
Type Description
NetworkClient.PingRequest

Service(Int32)

Declaration
public void Service(int timeoutMs)
Parameters
Type Name Description
System.Int32 timeoutMs

Shutdown(String)

Declaration
public void Shutdown(string byeMessage)
Parameters
Type Name Description
System.String byeMessage

SimulateDiscoverServer(StrangeWorld)

Declaration
public void SimulateDiscoverServer(StrangeWorld serverInfo)
Parameters
Type Name Description
StrangeWorld serverInfo

TryReceivePacket(Int32, out ReceivedNetworkPacket)

Declaration
[ClientAPI]
public bool TryReceivePacket(int queueIndex, out ReceivedNetworkPacket packet)
Parameters
Type Name Description
System.Int32 queueIndex
ReceivedNetworkPacket packet
Returns
Type Description
System.Boolean

Update()

Declaration
public void Update()

Implements

System.IDisposable

Extension Methods

CommandLine.FeedFromCommandLine(Object)
CommandLine.ToCommandLineArgs(Object, Func<Object, Boolean>)
ListUtil.DepthFirstTraversal<T>(T, Func<T, IEnumerable<T>>)
EnumerableExtensions.SingleItemAsEnumerable<T>(T)
EventUtils.RaiseEvent<TEventArgs>(Object, String, TEventArgs)
PredicateUtils.MatchesAll<TEnumerable, T>(T, TEnumerable)
PredicateUtils.MatchesAll<T>(T, Func<T, Boolean>[])
PredicateUtils.MatchesAny<TEnumerable, T>(T, TEnumerable)
ReflectionUtils.PropertyValue<T>(Object, PropertyInfo)
ReflectionUtils.TryGetPropertyValueByName<T>(Object, String, out T)
ReflectionUtils.GetPropertyValueByName<T>(Object, String)
ReflectionUtils.SetPropertyByName(Object, String, Object)
ReflectionUtils.GetStructPropertyByName<T>(Object, String)
ReflectionUtils.GetStringPropertyByName(Object, String)
ReflectionUtils.ZipByProperty<T>(Object, Object, Object, Func<T, T, T>)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾