本文整理汇总了C#中Framework.Network.Packets.PacketWriter.Flush方法的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter.Flush方法的具体用法?C# PacketWriter.Flush怎么用?C# PacketWriter.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework.Network.Packets.PacketWriter
的用法示例。
在下文中一共展示了PacketWriter.Flush方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Send
public void Send(ref PacketWriter packet)
{
if (packet.Opcode == 0)
return;
var buffer = packet.ReadDataToSend();
try
{
if (Crypt.IsInitialized)
{
uint totalLength = (uint)packet.Size - 2;
totalLength <<= 13;
totalLength |= ((uint)packet.Opcode & 0x1FFF);
var header = BitConverter.GetBytes(totalLength);
Crypt.Encrypt(header);
buffer[0] = header[0];
buffer[1] = header[1];
buffer[2] = header[2];
buffer[3] = header[3];
}
clientSocket.Send(buffer, 0, buffer.Length, SocketFlags.None);
string clientInfo = ((IPEndPoint)clientSocket.RemoteEndPoint).Address + ":" + ((IPEndPoint)clientSocket.RemoteEndPoint).Port;
PacketLog.WritePacket(clientInfo, packet);
packet.Flush();
}
catch (Exception ex)
{
Log.Message(LogType.Error, "{0}", ex.Message);
Log.Message();
clientSocket.Close();
}
}
示例2: Send
public async void Send(PacketWriter packet)
{
DataBuffer = packet.ReadDataToSend(true);
try
{
DataWriter writer = new DataWriter(clientSocket.OutputStream);
writer.WriteBytes(DataBuffer);
await writer.StoreAsync();
packet.Flush();
}
catch (Exception ex)
{
Log.Message(LogType.ERROR, "{0}", ex.Message);
Log.Message();
clientSocket.Dispose();
}
}
示例3: Send
public void Send(PacketWriter packet)
{
if (packet == null)
return;
DataBuffer = packet.ReadDataToSend(true);
try
{
clientSocket.Send(DataBuffer, DataBuffer.Length, SocketFlags.None);
packet.Flush();
}
catch (SocketException ex)
{
Log.Message(LogType.ERROR, "{0}", ex.Message);
Log.Message();
clientSocket.Close();
}
}
示例4: Send
public void Send(PacketWriter packet)
{
DataBuffer = packet.ReadDataToSend(true);
try
{
clientSocket.BeginSend(DataBuffer, 0, DataBuffer.Length, SocketFlags.None, new AsyncCallback(FinishSend), clientSocket);
packet.Flush();
}
catch (Exception ex)
{
Log.Message(LogType.ERROR, "{0}", ex.Message);
Log.Message();
clientSocket.Close();
}
}