mirror of
https://github.com/Stone-Red-Code/RemSox.git
synced 2026-09-06 07:46:29 +02:00
Add TcpRpc server and client and split crypto code into multiple classes
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using System.Net.Sockets;
|
||||
|
||||
/// <summary>
|
||||
/// Simple wrapper around TcpClient to hold connection-scoped resources safely.
|
||||
/// </summary>
|
||||
public class TcpConnection(TcpClient client) : IDisposable
|
||||
{
|
||||
public TcpClient Client { get; } = client;
|
||||
public NetworkStream Stream { get; } = client.GetStream();
|
||||
public SemaphoreSlim SendLock { get; } = new(1, 1);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Stream.Dispose();
|
||||
Client.Dispose();
|
||||
SendLock.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user