本文整理汇总了C#中System.Net.Sockets.Socket.ReceiveAllBytes方法的典型用法代码示例。如果您正苦于以下问题:C# Socket.ReceiveAllBytes方法的具体用法?C# Socket.ReceiveAllBytes怎么用?C# Socket.ReceiveAllBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Sockets.Socket
的用法示例。
在下文中一共展示了Socket.ReceiveAllBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public void Read(Socket socket)
{
this.Header = new ResultSetHeader();
this.Header.Read(socket);
this.Fields = new FieldPacket[this.Header.FieldPacketCount];
for (int i = 0; i < this.Header.FieldPacketCount; i++)
{
this.Fields[i] = new FieldPacket();
this.Fields[i].Read(socket);
}
if ((Capabilities & CapabilityFlags.CLIENT_DEPRECATE_EOF) == 0)
{
this.EOF = new EOFPacket();
this.EOF.Read(socket);
}
var rows = new List<RowPacket>();
ResultPacket packet;
do
{
var packetData = socket.ReceiveAllBytes();
packet = MySqlPacketFactory.GetResultPacket(packetData);
if (packet == null)
{
var row = new RowPacket();
row.Read(packetData.Data);
rows.Add(row);
}
else
{
break;
}
} while (true);
Result = packet;
}
示例2: GetResultPacket
public static ResultPacket GetResultPacket(Socket socket)
{
var packetData = socket.ReceiveAllBytes();
return GetResultPacket(packetData);
}