mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-12-11 20:15:10 +01:00
disconnect with ctrl c
This commit is contained in:
parent
8d239a41b5
commit
d03ad707cd
@ -58,19 +58,7 @@ public class Client
|
||||
}
|
||||
|
||||
_transport.Log($"connecting to {address}");
|
||||
var options = new SteamNetworkingConfigValue_t[]
|
||||
{
|
||||
new SteamNetworkingConfigValue_t
|
||||
{
|
||||
m_eValue = ESteamNetworkingConfigValue.k_ESteamNetworkingConfig_IP_AllowWithoutAuth,
|
||||
m_eDataType = ESteamNetworkingConfigDataType.k_ESteamNetworkingConfig_Int32,
|
||||
m_val = new SteamNetworkingConfigValue_t.OptionValue
|
||||
{
|
||||
m_int32 = 1,
|
||||
}
|
||||
}
|
||||
};
|
||||
_conn = SteamNetworkingSockets.ConnectByIPAddress(ref steamAddr, options.Length, options);
|
||||
_conn = SteamNetworkingSockets.ConnectByIPAddress(ref steamAddr, 0, new SteamNetworkingConfigValue_t[0]);
|
||||
}
|
||||
|
||||
public void Send(ArraySegment<byte> segment, int channelId)
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
using HarmonyLib;
|
||||
using Steamworks;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace SteamTransport;
|
||||
@ -77,7 +75,13 @@ public static class Program
|
||||
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
var running = true;
|
||||
Console.CancelKeyPress += (sender, args) =>
|
||||
{
|
||||
args.Cancel = true;
|
||||
running = false;
|
||||
};
|
||||
while (running)
|
||||
{
|
||||
transport.ServerEarlyUpdate();
|
||||
SteamAPI.RunCallbacks();
|
||||
@ -103,15 +107,18 @@ public static class Program
|
||||
|
||||
try
|
||||
{
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
while (true)
|
||||
var running = true;
|
||||
Console.CancelKeyPress += (sender, args) =>
|
||||
{
|
||||
args.Cancel = true;
|
||||
running = false;
|
||||
};
|
||||
while (running)
|
||||
{
|
||||
transport.ClientEarlyUpdate();
|
||||
SteamAPI.RunCallbacks();
|
||||
transport.ClientLateUpdate();
|
||||
Thread.Sleep(10);
|
||||
|
||||
if (stopwatch.ElapsedMilliseconds > 10 * 1000) break;
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
||||
@ -52,17 +52,11 @@ public class Server
|
||||
|
||||
public void Send(int connectionId, ArraySegment<byte> segment, int channelId) { }
|
||||
|
||||
public void RecieveData()
|
||||
{
|
||||
}
|
||||
public void RecieveData() { }
|
||||
|
||||
public void Flush()
|
||||
{
|
||||
}
|
||||
public void Flush() { }
|
||||
|
||||
public void Disconnect(int connectionId)
|
||||
{
|
||||
}
|
||||
public void Disconnect(int connectionId) { }
|
||||
|
||||
public void Close()
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user