Class SteamFactory<TRoot>
- Namespace
- MarymoorStudios.Core.Steamworks.Rpc
- Assembly
- MarymoorStudios.Core.Steamworks.Rpc.dll
Establishes a scope for incoming and outgoing Steam Networking Sockets based channels.
public sealed class SteamFactory<TRoot> : IPromiseDisposable where TRoot : AServer<TRoot>
Type Parameters
TRoot
The type of the root object exposed on all connection (incoming and outgoing) within the scope of this factory.
- Inheritance
-
SteamFactory<TRoot>
- Implements
- Inherited Members
Remarks
Enables the creation of incoming listeners for receiving network connections from remote parties using Steam Networking Sockets.
Enables the establishment of outgoing connections to remote parties using Steam Networking Sockets.
A SteamFactory<TRoot> instance represents a set of such incoming and outgoing connections that can be torn down collectively (by disposing the factory instance).
Methods
Connect<TProxy, TServer>(CSteamID, int, CancellationToken)
Create a new outgoing connection within this Steam scope.
public TProxy Connect<TProxy, TServer>(CSteamID peer, int localVirtualPort = 0, CancellationToken cancel = default) where TProxy : Proxy<TServer>, IProxy<TProxy, TServer> where TServer : AServer<TServer>
Parameters
peer
CSteamIDThe steam id of the peer to connect to.
localVirtualPort
intThe 0-based index of the virtual port to use.
cancel
CancellationTokenA (optional) cancellation that can be used to terminate this connection independently of the rest of the Steam scope.
Returns
- TProxy
The remote root
Type Parameters
TProxy
The type of the expected remote root.
TServer
The server type of
TProxy
.
Connect<TProxy, TServer>(IPEndPoint, CancellationToken)
Create a new outgoing connection within this Steam scope.
public TProxy Connect<TProxy, TServer>(IPEndPoint endpoint, CancellationToken cancel = default) where TProxy : Proxy<TServer>, IProxy<TProxy, TServer> where TServer : AServer<TServer>
Parameters
endpoint
IPEndPointThe remote endpoint to connect to.
cancel
CancellationTokenA (optional) cancellation that can be used to terminate this connection independently of the rest of the Steam scope.
Returns
- TProxy
The remote root
Type Parameters
TProxy
The type of the expected remote root.
TServer
The server type of
TProxy
.
DisposeAsync()
public Promise DisposeAsync()
Returns
Listen(IPEndPoint)
Create a new incoming listening endpoint for this Steam scope.
public Promise<SteamListener> Listen(IPEndPoint endpoint)
Parameters
endpoint
IPEndPointThe endpoint on which to listen.
Returns
- Promise<SteamListener>
Resolves to a SteamListener for controlling the lifetime of the listening endpoint.
ListenFakeIp(int)
Create a new incoming listening endpoint for this Steam scope.
public Promise<SteamListener> ListenFakeIp(int indexFakePort = 0)
Parameters
indexFakePort
intThe 0-based index of the FakeIP to use.
Returns
- Promise<SteamListener>
Resolves to a SteamListener for controlling the lifetime of the listening endpoint.
Remarks
The FakeIP MUST have been previously allocated.
ListenP2P(int)
Create a new incoming listening endpoint for this Steam scope.
public Promise<SteamListener> ListenP2P(int localVirtualPort = 0)
Parameters
localVirtualPort
intThe 0-based index of the virtual port to use.
Returns
- Promise<SteamListener>
Resolves to a SteamListener for controlling the lifetime of the listening endpoint.