Created
March 7, 2015 22:39
-
-
Save ThuCommix/ea41e0ebb7e67ce5e0ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Sends the data. | |
/// </summary> | |
/// <param name="buffer">The Buffer.</param> | |
/// <param name="count">The Count.</param> | |
/// <param name="member">The SessionMember.</param> | |
public void Send(byte[] buffer, int count, SessionMember member) | |
{ | |
var data = new byte[10 + count]; | |
var msg = BitConverter.GetBytes((short) SystemMessage.UserDatagram); | |
var ip = member.IpEndPoint.Address.GetAddressBytes(); | |
var port = BitConverter.GetBytes(member.IpEndPoint.Port); | |
Array.Copy(msg, 0, data, 0, 2); | |
Array.Copy(ip, 0, data, 2, 4); | |
Array.Copy(port, 0, data, 6, 4); | |
Array.Copy(buffer, 0, data, 10, count); | |
_udpService.BeginSend(data, count + 10, AsyncSentCallback, new AsyncSentState(count + 10)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment