mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-27 07:05:50 +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>
|
/// <summary>
|
||||||
/// Creates a server that will be relayed via Valve's network (hiding the IP and improving ping)
|
/// 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>
|
/// </summary>
|
||||||
public static T CreateRelaySocket<T>( int virtualport = 0 ) where T : SocketManager, new()
|
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;
|
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>
|
/// <summary>
|
||||||
/// Connect to a relay server
|
/// Connect to a relay server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user