mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-26 06:35:49 +03:00
Add interface method for CreateRelayServer
This commit is contained in:
parent
0beaeb2e9d
commit
aa1751071d
@ -167,6 +167,9 @@ public static ConnectionManager ConnectNormal( NetAddress address, IConnectionMa
|
||||
|
||||
/// <summary>
|
||||
/// Creates a server that will be relayed via Valve's network (hiding the IP and improving ping)
|
||||
///
|
||||
/// To use this derive a class from SocketManager and override as much as you want.
|
||||
///
|
||||
/// </summary>
|
||||
public static T CreateRelaySocket<T>( int virtualport = 0 ) where T : SocketManager, new()
|
||||
{
|
||||
@ -178,6 +181,31 @@ public static ConnectionManager ConnectNormal( NetAddress address, IConnectionMa
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a server that will be relayed via Valve's network (hiding the IP and improving ping)
|
||||
///
|
||||
/// To use this you should pass a class that inherits ISocketManager. You can use
|
||||
/// SocketManager to get connections and send messages, but the ISocketManager class
|
||||
/// will received all the appropriate callbacks.
|
||||
///
|
||||
/// </summary>
|
||||
public static SocketManager CreateRelaySocket( int virtualport, ISocketManager intrface )
|
||||
{
|
||||
var options = Array.Empty<NetKeyValue>();
|
||||
var socket = Internal.CreateListenSocketP2P( virtualport, options.Length, options );
|
||||
|
||||
var t = new SocketManager
|
||||
{
|
||||
Socket = socket,
|
||||
Interface = intrface
|
||||
};
|
||||
|
||||
t.Initialize();
|
||||
|
||||
SetSocketManager( t.Socket.Id, t );
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Connect to a relay server
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user