Interface INetworkConnection
Assembly: SociallyDistant.Framework.dll
Syntax
public interface INetworkConnection : INetworkInterfaceEnumerator
Properties
Connected
Declaration
Property Value
Identifier
Declaration
Property Value
LocalAddress
Declaration
uint LocalAddress { get; }
Property Value
LoopbackAddress
Declaration
uint LoopbackAddress { get; }
Property Value
PublicAddress
Declaration
uint? PublicAddress { get; }
Property Value
Methods
ConnectToServer<TNetworkClient>(uint, ushort)
Try to connect to a remote server on the given port.
Declaration
TNetworkClient? ConnectToServer<TNetworkClient>(uint remoteAddress, ushort port) where TNetworkClient : INetworkClient
Parameters
Type |
Name |
Description |
uint |
remoteAddress |
The IP address of the remote server.
|
ushort |
port |
The remote port of the server.
|
Returns
Type |
Description |
TNetworkClient |
An instance of TNetworkClient if the connection was possible, null otherwise.
|
Type Parameters
Name |
Description |
TNetworkClient |
The type of connection to establish.
|
CreateServer<TNetworkServer, TNetworkClient>(ushort)
Declaration
TNetworkServer CreateServer<TNetworkServer, TNetworkClient>(ushort port) where TNetworkServer : class, INetworkServer, IAcceptNetworkClient<TNetworkClient> where TNetworkClient : INetworkClient
Parameters
Type |
Name |
Description |
ushort |
port |
|
Returns
Type |
Description |
TNetworkServer |
|
Type Parameters
Name |
Description |
TNetworkServer |
|
TNetworkClient |
|
GetHostName(uint)
Declaration
string GetHostName(uint address)
Parameters
Type |
Name |
Description |
uint |
address |
|
Returns
GetListeningPorts()
Declaration
IEnumerable<ushort> GetListeningPorts()
Returns
IsListening(ushort)
Declaration
bool IsListening(ushort port)
Parameters
Type |
Name |
Description |
ushort |
port |
|
Returns
Ping(uint, float, bool)
Ping the specified host, returning a PingResult indicating whether the host is online.
Declaration
Task<PingResult> Ping(uint address, float timeout, bool fakeTimeouts)
Parameters
Type |
Name |
Description |
uint |
address |
The address of the host to ping.
|
float |
timeout |
A timeout, in seconds, to wait for a response.
|
bool |
fakeTimeouts |
A value indicating whether the game should fake a timeout if a host is known not to exist in the game world. Set to false if pinging many hosts in bulk, like in the nmap command.
|
Returns
Resolve(string, out uint)
Try to resolve a given hostname or IP address string to a numeric IP address.
Declaration
bool Resolve(string host, out uint address)
Parameters
Type |
Name |
Description |
string |
host |
The host to resolve
|
uint |
address |
The result of the address or hostname resolution. Will be 0 if resolution failed.
|
Returns
Type |
Description |
bool |
True if the host was successfully resolved. False if DNS resolution failed or the IP string failed to parse.
|
ScanPort(uint, ushort)
Declaration
Task<PortScanResult> ScanPort(uint address, ushort port)
Parameters
Returns