diff --git a/DTLib.Network/TCPSocketClient.cs b/DTLib.Network/TCPSocketClient.cs index 511ede9..941832b 100644 --- a/DTLib.Network/TCPSocketClient.cs +++ b/DTLib.Network/TCPSocketClient.cs @@ -29,7 +29,7 @@ public class TCPSocketClient : IDisposable public void Dispose() => Stop(); - public void Send(byte[] buffer) + public void Send(ref byte[] buffer) { if (_mainSocket is null) throw new NullReferenceException("TCP socket is null! You have to call Connect() befure calling Send()"); @@ -40,6 +40,6 @@ public class TCPSocketClient : IDisposable { if (_mainSocket is null) throw new NullReferenceException("TCP socket is null! You have to call Connect() befure calling Recieve()"); - _mainSocket.Receive(buffer); + return _mainSocket.Receive(buffer); } } \ No newline at end of file diff --git a/DTLib.Network/TCPSocketServer.cs b/DTLib.Network/TCPSocketServer.cs index b09852a..06e63a5 100644 --- a/DTLib.Network/TCPSocketServer.cs +++ b/DTLib.Network/TCPSocketServer.cs @@ -98,4 +98,18 @@ public class TCPSocketServer : IDisposable } public void Dispose() => Stop(); + + public void Send(ref byte[] buffer) + { + if (_mainSocket is null) + throw new NullReferenceException("TCP socket is null! You have to call Connect() befure calling Send()"); + _mainSocket.Send(buffer); + } + + public int Recieve(ref byte[] buffer) + { + if (_mainSocket is null) + throw new NullReferenceException("TCP socket is null! You have to call Connect() befure calling Recieve()"); + return _mainSocket.Receive(buffer); + } } \ No newline at end of file