本文整理汇总了C#中PacketAckPacket.ToBytes方法的典型用法代码示例。如果您正苦于以下问题:C# PacketAckPacket.ToBytes方法的具体用法?C# PacketAckPacket.ToBytes怎么用?C# PacketAckPacket.ToBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketAckPacket
的用法示例。
在下文中一共展示了PacketAckPacket.ToBytes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendAckImmediate
public virtual void SendAckImmediate(IPEndPoint remoteEndpoint, PacketAckPacket ack)
{
byte[] packetData = ack.ToBytes();
int length = packetData.Length;
UDPPacketBuffer buffer = new UDPPacketBuffer(remoteEndpoint, length);
buffer.DataLength = length;
Buffer.BlockCopy(packetData, 0, buffer.Data, 0, length);
AsyncBeginSend(buffer);
}
示例2: SendAckImmediate
private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
{
PacketAckPacket ack = new PacketAckPacket();
ack.Header.Reliable = false;
ack.Packets = new PacketAckPacket.PacketsBlock[1];
ack.Packets[0] = new PacketAckPacket.PacketsBlock();
ack.Packets[0].ID = sequenceNumber;
byte[] packetData = ack.ToBytes();
int length = packetData.Length;
UDPPacketBuffer buffer = new UDPPacketBuffer(remoteEndpoint, length);
buffer.DataLength = length;
Buffer.BlockCopy(packetData, 0, buffer.Data, 0, length);
// AsyncBeginSend(buffer);
SyncSend(buffer);
}
示例3: SendAckImmediate
private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
{
PacketAckPacket ack = new PacketAckPacket();
ack.Header.Reliable = false;
ack.Packets = new PacketAckPacket.PacketsBlock[1];
ack.Packets[0] = new PacketAckPacket.PacketsBlock();
ack.Packets[0].ID = sequenceNumber;
byte[] packetData = ack.ToBytes();
int length = packetData.Length;
OutgoingPacket outgoingPacket = new OutgoingPacket(null, packetData, 0, length,
remoteEndpoint, false, PacketType.PacketAck);
AsyncBeginSend(outgoingPacket);
}
示例4: SendACK
private void SendACK(uint id)
{
try
{
PacketAckPacket ack = new PacketAckPacket();
ack.Packets = new PacketAckPacket.PacketsBlock[1];
ack.Packets[0].ID = id;
ack.Header.Reliable = false;
// Set the sequence number
ack.Header.Sequence = ++Sequence;
Listener.SendTo(ack.ToBytes(), RemoteEndpoint);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
示例5: SendAckImmediate
private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
{
PacketAckPacket ack = new PacketAckPacket
{Header = {Reliable = false}, Packets = new PacketAckPacket.PacketsBlock[1]};
ack.Packets[0] = new PacketAckPacket.PacketsBlock {ID = sequenceNumber};
byte[] packetData = ack.ToBytes();
int length = packetData.Length;
UDPPacketBuffer buffer = new UDPPacketBuffer(remoteEndpoint, length) {DataLength = length};
Buffer.BlockCopy(packetData, 0, buffer.Data, 0, length);
SyncSend(buffer);
}