TCP Send and Recieve
This commit is contained in:
parent
86161b5c95
commit
34ae7c2e2b
@ -29,7 +29,7 @@ public class TCPSocketClient : IDisposable
|
|||||||
|
|
||||||
public void Dispose() => Stop();
|
public void Dispose() => Stop();
|
||||||
|
|
||||||
public void Send(byte[] buffer)
|
public void Send(ref byte[] buffer)
|
||||||
{
|
{
|
||||||
if (_mainSocket is null)
|
if (_mainSocket is null)
|
||||||
throw new NullReferenceException("TCP socket is null! You have to call Connect() befure calling Send()");
|
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)
|
if (_mainSocket is null)
|
||||||
throw new NullReferenceException("TCP socket is null! You have to call Connect() befure calling Recieve()");
|
throw new NullReferenceException("TCP socket is null! You have to call Connect() befure calling Recieve()");
|
||||||
_mainSocket.Receive(buffer);
|
return _mainSocket.Receive(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,4 +98,18 @@ public class TCPSocketServer : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() => Stop();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user