本文整理匯總了C#中System.Net.Sockets.Socket.IOControl方法的典型用法代碼示例。如果您正苦於以下問題:C# Socket.IOControl方法的具體用法?C# Socket.IOControl怎麽用?C# Socket.IOControl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Net.Sockets.Socket
的用法示例。
在下文中一共展示了Socket.IOControl方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DisplayPendingByteCount
static void DisplayPendingByteCount(Socket s)
{
byte[] outValue = BitConverter.GetBytes(0);
// Check how many bytes have been received.
s.IOControl(IOControlCode.DataToRead, null, outValue);
uint bytesAvailable = BitConverter.ToUInt32(outValue, 0);
Console.Write("server has {0} bytes pending. ",
bytesAvailable);
Console.WriteLine("Available property says {1}.",
s.Available);
return;
}
示例2: DisplayPendingByteCount
// FIONREAD is also available as the "Available" property.
public const int FIONREAD = 0x4004667F;
static void DisplayPendingByteCount(Socket s)
{
byte[] outValue = BitConverter.GetBytes(0);
// Check how many bytes have been received.
s.IOControl(FIONREAD, null, outValue);
uint bytesAvailable = BitConverter.ToUInt32(outValue, 0);
Console.WriteLine("server has {0} bytes pending. Available property says {1}.",
bytesAvailable, s.Available);
return;
}