mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-29 08:05:33 +03:00
Connection SendMessage
This commit is contained in:
parent
5fdbf02b29
commit
0265eda9f0
@ -52,6 +52,34 @@ public string ConnectionName
|
|||||||
set => SteamNetworkingSockets.Internal.SetConnectionName( this, value );
|
set => SteamNetworkingSockets.Internal.SetConnectionName( this, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Result SendMessage( IntPtr ptr, int size, SendType sendType = SendType.Reliable )
|
||||||
|
{
|
||||||
|
return SteamNetworkingSockets.Internal.SendMessageToConnection( this, ptr, (uint) size, (int)sendType );
|
||||||
|
}
|
||||||
|
|
||||||
|
public unsafe Result SendMessage( byte[] data, SendType sendType = SendType.Reliable )
|
||||||
|
{
|
||||||
|
fixed ( byte* ptr = data )
|
||||||
|
{
|
||||||
|
return SendMessage( (IntPtr)ptr, data.Length, sendType );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public unsafe Result SendMessage( byte[] data, int offset, int length, SendType sendType = SendType.Reliable )
|
||||||
|
{
|
||||||
|
fixed ( byte* ptr = data )
|
||||||
|
{
|
||||||
|
return SendMessage( (IntPtr)ptr + offset, length, sendType );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public unsafe Result SendMessage( string str, SendType sendType = SendType.Reliable )
|
||||||
|
{
|
||||||
|
var bytes = System.Text.Encoding.UTF8.GetBytes( str );
|
||||||
|
return SendMessage( bytes, sendType );
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flush any messages waiting on the Nagle timer and send them at the next transmission opportunity (often that means right now).
|
/// Flush any messages waiting on the Nagle timer and send them at the next transmission opportunity (often that means right now).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user