Mono Class Library: System.Net.Sockets.Socket Overview | MembersSystem.Net.Sockets.Socket.IOControl Method |
Provides low-level access to the socket, the transport protocol, or the communications subsystem. [Edit]
|
A int containing the length of the optionOutValue array after the method returns. [Edit]
Type Reason System.Security.Permissions.SecurityPermission [Edit] Requires permission to access unmanaged code. See System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode.
Type Reason InvalidOperationException An attempt was made to change the blocking mode.
Note:[Edit]Use the Socket.Blocking property to change the blocking mode.
System.Net.Sockets.SocketException Note: For additional information on causes of the SocketException, see the System.Net.Sockets.SocketException class.[Edit]ObjectDisposedException The current instance has been disposed. [Edit] System.Security.SecurityException A caller in the call stack does not have the required permissions. [Edit]
If an attempt is made to change the blocking mode of the current instance, an exception is thrown. Use the Socket.Blocking property to change the blocking mode.
The control codes and their requirements are implementation defined. Do not use this method if platform independence is a requirement.
Note: Input data is not required for all control codes. Output data is not supplied by all control codes and, if not supplied, the return value is 0.[Edit]
The following example gets the number of bytes of available data to be read and writes the result to the console on a Windows system. The remote endpoint (remoteEndpoint) to connect to might need to be changed to a value that is valid on the current system.
C# Example using System; using System.Net; using System.Net.Sockets; class App { static void Main() { IPAddress remoteAddress = Dns.Resolve(Dns.GetHostName()).AddressList[0]; IPEndPoint remoteEndpoint = new IPEndPoint(remoteAddress, 80); Socket someSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); someSocket.Connect(remoteEndpoint); int fionRead = 0x4004667F; byte[]inValue = {0x00, 0x00, 0x00, 0x00}; byte[]outValue = {0x00, 0x00, 0x00, 0x00}; someSocket.IOControl(fionRead, inValue, outValue); uint bytesAvail = BitConverter.ToUInt32(outValue, 0); Console.WriteLine( "There are {0} bytes available to be read.", bytesAvail.ToString() ); } }The output is
There are 0 bytes available to be read.
Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0