Class NetConnection¶
Namespace: Apogee.Network
Assembly: Apogee.Network.dll
One connection to another program, made by
public sealed class NetConnection : EngineObject
Inheritance¶
object ← EngineObject ← NetConnection
Inherited Members¶
EngineObject.IsAdopted, EngineObject.Handle, EngineObject.IsDestroyed, EngineObject.Class, EngineObject.Adopt(), EngineObject.TryGet(SlotHandle, out EngineObject), EngineObject.Destroy(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Fields¶
RefusedReason¶
The reason code of a connection that a handler of
public const int RefusedReason = 1001
Field Value¶
Properties¶
Address¶
The other side's address (the one that was asked for, for a connection we made).
public string Address { get; }
Property Value¶
BytesIn¶
Bytes a second being received.
public float BytesIn { get; }
Property Value¶
BytesOut¶
Bytes a second being sent.
public float BytesOut { get; }
Property Value¶
Class¶
What the registry knows about this object's class.
public override ClassInfo Class { get; }
Property Value¶
IsIncoming¶
True for a connection that somebody made to our port, false for one we made.
public bool IsIncoming { get; }
Property Value¶
Ping¶
The round trip time in milliseconds, or -1 when it is not known yet.
public int Ping { get; }
Property Value¶
Quality¶
0 to 1: the share of our packets that arrive, as the other side measures it.
public float Quality { get; }
Property Value¶
State¶
public NetState State { get; }
Property Value¶
Methods¶
Close(string, bool)¶
Ends the connection. Messages still waiting are sent first when linger. The other side gets reason;
here no signal is emitted (we asked for it).
public void Close(string reason = "", bool linger = true)
Parameters¶
reason string
linger bool
ConfigureLanes(int)¶
Gives the connection count lanes: messages on one lane arrive in order and a slow one does not hold up the others. Before the first message.
public bool ConfigureLanes(int count)
Parameters¶
count int
Returns¶
Refuse()¶
In a handler of
public void Refuse()
Send(string, bool, int)¶
Sends text (UTF-8) to the other side. reliable messages arrive, once and in order; the others may be lost, never twice, and are for what is out of date a moment later (positions).
lane is the lane set by
public bool Send(string data, bool reliable = true, int lane = 0)
Parameters¶
data string
reliable bool
lane int
Returns¶
SendBytes(ReadOnlySpan<byte>, bool, int)¶
Sends bytes: what
public bool SendBytes(ReadOnlySpan<byte> data, bool reliable = true, int lane = 0)
Parameters¶
data ReadOnlySpan<byte>
reliable bool
lane int