mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 20:53:40 -04:00
Add LowLatency setter to INetworkSocket
This commit is contained in:
parent
9062dbc68f
commit
282edd2ca3
@ -26,6 +26,9 @@ namespace MCGalaxy.Network {
|
|||||||
/// <summary> Gets the remote IP of this socket. </summary>
|
/// <summary> Gets the remote IP of this socket. </summary>
|
||||||
string RemoteIP { get; }
|
string RemoteIP { get; }
|
||||||
|
|
||||||
|
/// <summary> Sets whether this socket operates in low-latency mode (e.g. for TCP, disabes nagle's algorithm). </summary>
|
||||||
|
bool LowLatency { set; }
|
||||||
|
|
||||||
/// <summary> Receives next block of received data, asynchronously. </summary>
|
/// <summary> Receives next block of received data, asynchronously. </summary>
|
||||||
void ReceiveNextAsync();
|
void ReceiveNextAsync();
|
||||||
|
|
||||||
|
@ -33,6 +33,10 @@ namespace MCGalaxy.Network {
|
|||||||
get { return ((IPEndPoint)socket.RemoteEndPoint).Address.ToString(); }
|
get { return ((IPEndPoint)socket.RemoteEndPoint).Address.ToString(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool LowLatency {
|
||||||
|
set { socket.NoDelay = value; }
|
||||||
|
}
|
||||||
|
|
||||||
static AsyncCallback recvCallback = new AsyncCallback(ReceiveCallback);
|
static AsyncCallback recvCallback = new AsyncCallback(ReceiveCallback);
|
||||||
public void ReceiveNextAsync() {
|
public void ReceiveNextAsync() {
|
||||||
socket.BeginReceive(tempbuffer, 0, tempbuffer.Length, SocketFlags.None, recvCallback, this);
|
socket.BeginReceive(tempbuffer, 0, tempbuffer.Length, SocketFlags.None, recvCallback, this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user