Networking System [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.x.x 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.Object System.IDisposable

The following examples provide a client/server application that demonstrates the use of asynchronous communication between sockets. Run the client and server on different consoles.

The following code is for the server application. Start this application before the client application.

`using System; using System.Threading; using System.Text; using System.Net; using System.Net.Sockets; public class Server { // used to pass state information to delegate internal class StateObject { internal byte[] sBuffer; internal Socket sSocket; internal StateObject(int size, Socket sock) { sBuffer = new byte[size]; sSocket = sock; } } static void Main() { IPAddress ipAddress = Dns.Resolve( Dns.GetHostName() ).AddressList[0]; IPEndPoint ipEndpoint = new IPEndPoint(ipAddress, 1800); Socket listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); listenSocket.Bind(ipEndpoint); listenSocket.Listen(1); IAsyncResult asyncAccept = listenSocket.BeginAccept( new AsyncCallback(Server.acceptCallback), listenSocket ); // could call listenSocket.EndAccept(asyncAccept) here // instead of in the callback method, but since // EndAccept blocks, the behavior would be similar to // calling the synchronous Accept method Console.Write("Connection in progress."); if( writeDot(asyncAccept) == true ) { // allow time for callbacks to // finish before the program ends Thread.Sleep(3000); } } public static void acceptCallback(IAsyncResult asyncAccept) { Socket listenSocket = (Socket)asyncAccept.AsyncState; Socket serverSocket = listenSocket.EndAccept(asyncAccept); // arriving here means the operation completed // (asyncAccept.IsCompleted = true) but not // necessarily successfully if( serverSocket.Connected == false ) { Console.WriteLine( ".server is not connected." ); return; } else Console.WriteLine( ".server is connected." ); listenSocket.Close(); StateObject stateObject = new StateObject(16, serverSocket); // this call passes the StateObject because it // needs to pass the buffer as well as the socket IAsyncResult asyncReceive = serverSocket.BeginReceive( stateObject.sBuffer, 0, stateObject.sBuffer.Length, SocketFlags.None, new AsyncCallback(receiveCallback), stateObject); Console.Write("Receiving data."); writeDot(asyncReceive); } public static void receiveCallback(IAsyncResult asyncReceive) { StateObject stateObject = (StateObject)asyncReceive.AsyncState; int bytesReceived = stateObject.sSocket.EndReceive(asyncReceive); Console.WriteLine( ".{0} bytes received: {1}", bytesReceived.ToString(), Encoding.ASCII.GetString(stateObject.sBuffer) ); byte[] sendBuffer = Encoding.ASCII.GetBytes("Goodbye"); IAsyncResult asyncSend = stateObject.sSocket.BeginSend( sendBuffer, 0, sendBuffer.Length, SocketFlags.None, new AsyncCallback(sendCallback), stateObject.sSocket); Console.Write("Sending response."); writeDot(asyncSend); } public static void sendCallback(IAsyncResult asyncSend) { Socket serverSocket = (Socket)asyncSend.AsyncState; int bytesSent = serverSocket.EndSend(asyncSend); Console.WriteLine( ".{0} bytes sent.{1}{1}Shutting down.", bytesSent.ToString(), Environment.NewLine ); serverSocket.Shutdown(SocketShutdown.Both); serverSocket.Close(); } // times out after 20 seconds but operation continues internal static bool writeDot(IAsyncResult ar) { int i = 0; while( ar.IsCompleted == false ) { if( i++ > 40 ) { Console.WriteLine("Timed out."); return false; } Console.Write("."); Thread.Sleep(500); } return true; } }`

The following code is for the client application. When starting the application, supply the hostname of the console running the server application as an input parameter (for example, ProgramName ).

`using System; using System.Threading; using System.Text; using System.Net; using System.Net.Sockets; public class Client { // used to pass state information to delegate class StateObject { internal byte[] sBuffer; internal Socket sSocket; internal StateObject(int size, Socket sock) { sBuffer = new byte[size]; sSocket = sock; } } static void Main(string[] argHostName) { IPAddress ipAddress = Dns.Resolve( argHostName[0] ).AddressList[0]; IPEndPoint ipEndpoint = new IPEndPoint(ipAddress, 1800); Socket clientSocket = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IAsyncResult asyncConnect = clientSocket.BeginConnect( ipEndpoint, new AsyncCallback(connectCallback), clientSocket ); Console.Write("Connection in progress."); if( writeDot(asyncConnect) == true ) { // allow time for callbacks to // finish before the program ends Thread.Sleep(3000); } } public static void connectCallback(IAsyncResult asyncConnect) { Socket clientSocket = (Socket)asyncConnect.AsyncState; clientSocket.EndConnect(asyncConnect); // arriving here means the operation completed // (asyncConnect.IsCompleted = true) but not // necessarily successfully if( clientSocket.Connected == false ) { Console.WriteLine( ".client is not connected." ); return; } else Console.WriteLine( ".client is connected." ); byte[] sendBuffer = Encoding.ASCII.GetBytes("Hello"); IAsyncResult asyncSend = clientSocket.BeginSend( sendBuffer, 0, sendBuffer.Length, SocketFlags.None, new AsyncCallback(sendCallback), clientSocket); Console.Write("Sending data."); writeDot(asyncSend); } public static void sendCallback(IAsyncResult asyncSend) { Socket clientSocket = (Socket)asyncSend.AsyncState; int bytesSent = clientSocket.EndSend(asyncSend); Console.WriteLine( ".{0} bytes sent.", bytesSent.ToString() ); StateObject stateObject = new StateObject(16, clientSocket); // this call passes the StateObject because it // needs to pass the buffer as well as the socket IAsyncResult asyncReceive = clientSocket.BeginReceive( stateObject.sBuffer, 0, stateObject.sBuffer.Length, SocketFlags.None, new AsyncCallback(receiveCallback), stateObject); Console.Write("Receiving response."); writeDot(asyncReceive); } public static void receiveCallback(IAsyncResult asyncReceive) { StateObject stateObject = (StateObject)asyncReceive.AsyncState; int bytesReceived = stateObject.sSocket.EndReceive(asyncReceive); Console.WriteLine( ".{0} bytes received: {1}{2}{2}Shutting down.", bytesReceived.ToString(), Encoding.ASCII.GetString(stateObject.sBuffer), Environment.NewLine ); stateObject.sSocket.Shutdown(SocketShutdown.Both); stateObject.sSocket.Close(); } // times out after 2 seconds but operation continues internal static bool writeDot(IAsyncResult ar) { int i = 0; while( ar.IsCompleted == false ) { if( i++ > 20 ) { Console.WriteLine("Timed out."); return false; } Console.Write("."); Thread.Sleep(100); } return true; } }`

The output of the server application is

Connection in progress...........server is connected.

Receiving data......5 bytes received: Hello

Sending response....7 bytes sent.

Shutting down.

-----------------------------------------

The output of the client application is

Connection in progress......client is connected.

Sending data......5 bytes sent.

Receiving response......7 bytes received: Goodbye

Shutting down.

The class provides a rich set of methods and properties for network communications. The class allows you to perform both synchronous and asynchronous data transfer using any of the communication protocols listed in the enumeration.

The class follows the .NET Framework naming pattern for asynchronous methods. For example, the synchronous method corresponds to the asynchronous and methods.

If your application only requires one thread during execution, use the following methods, which are designed for synchronous operation mode.

If you are using a connection-oriented protocol such as TCP, your server can listen for connections using the method. The method processes any incoming connection requests and returns a that you can use to communicate data with the remote host. Use this returned to call the or method. Call the method prior to calling the method if you want to specify the local IP address and port number. Use a port number of zero if you want the underlying service provider to assign a free port for you. If you want to connect to a listening host, call the method. To communicate data, call the or method.

If you are using a connectionless protocol such as UDP, you do not need to listen for connections at all. Call the method to accept any incoming datagrams. Use the method to send datagrams to a remote host.

To process communications using separate threads during execution, use the following methods, which are designed for asynchronous operation mode.

If you are using a connection-oriented protocol such as TCP, use the , , and methods to connect with a listening host. Use the and or and methods to communicate data asynchronously. Incoming connection requests can be processed using and .

If you are using a connectionless protocol such as UDP, you can use and to send datagrams, and and to receive datagrams.

If you perform multiple asynchronous operations on a socket, they do not necessarily complete in the order in which they are started.

When you are finished sending and receiving data, use the method to disable the . After calling , call the method to release all resources associated with the .

The class allows you to configure your using the method. Retrieve these settings using the method.

If you are writing a relatively simple application and do not require maximum performance, consider using , , and . These classes provide a simpler and more user-friendly interface to communications.

Implements the Berkeley sockets interface.

- Constructor
  2.0.0.0
  4.0.0.0

  If you call the constructor multiple times with the same byte array as the argument for each call, you will create multiple managed s with the same underlying socket. This practice is strongly discouraged.

  Initializes a new instance of the class using the specified value returned from .

  The socket information returned by .
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  The combination of , , and is invalid.

  -or-

  An error occurred while creating the socket.

  For additional information on causes of the , see the class.

  The parameter specifies the addressing scheme that the class uses, the parameter specifies the type of the class, and the parameter specifies the protocol used by . The three parameters are not independent. Some address families restrict which protocols can be used with them, and often the type is implicit in the protocol. If the combination of address family, type, and protocol type results in an invalid , this constructor throws a .

  If this constructor throws a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Initializes a new instance of the class using the specified address family, socket type and protocol.

  One of the values.
  One of the values.
  One of the values.
  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Net.Sockets.Socket An error occurred while creating the new .

  An asynchronous call is pending and a blocking method has been called.

  An error occurred while accessing the listening socket or while creating the new socket.

  -or-

  The property is set to .

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  synchronously extracts the first pending connection request from the connection request queue of the listening socket, and then creates and returns a new . You cannot use this returned to accept any additional connections from the connection queue. However, you can call the method of the returned to identify the remote host's network address and port number.

  In blocking mode, blocks until an incoming connection attempt is queued. Once a connection is accepted, the original continues queuing incoming connection requests until you close it.

  If you call this method using a non-blocking , and no connection requests are queued, throws a . If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  Before calling the method, you must first call the method to listen for and queue incoming connection requests.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Creates a new for a newly created connection.

  A for a newly created connection.

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  Connection-oriented protocols can use the method to asynchronously process incoming connection attempts. Accepting connections asynchronously gives you the ability to send and receive data within a separate execution thread. Before calling the method, you must call the method to listen for and queue incoming connection requests.

  To be notified of completion, you must create a callback method that implements the EventHandler<SocketAsyncEventArgs> delegate and hook it to the event.

  The following properties and events on the object are required:

  The caller can optionally specify an existing to use for the incoming connection by specifying the to use with the property.

  If the property is null, a new is constructed with the same , , and as the current and set as the property.

  The caller may set the property to any user state object desired before calling the method, so that the information will be retrievable in the callback method. If the callback needs more information than a single object, a small class can be created to hold the other required state information as members.

  Optionally, a buffer may be provided in which to receive the initial block of data on the socket after the method succeeds. In this case, the property needs to be set to the buffer containing the data to receive and the property needs to be set to the maximum number of bytes of data to receive in the buffer. These properties can be set using the method. Part of the buffer passed in will be consumed internally for use by the the underlying Winsock AcceptEx call. This means that the amount of data returned will always be less than the value of the property on the instance provided. The amount of the buffer used internally varies based on the address family of the socket. The minimum buffer size required is 288 bytes. If a larger buffer size is specified, then the will expect some extra data other than the address data received by the Winsock AcceptEx call and will wait until this extra data is received. If a timeout occurs, the connection is reset. So if extra data is expected of a specific amount, then the buffer size should be set to the minimum buffer size plus this amount.

  The completion callback method should examine the property to determine if the operation was successful.

  The event can occur in some cases when no connection has been accepted and cause the property to be set to . This can occur as a result of port scanning using a half-open SYN type scan (a SYN -> SYN-ACK -> RST sequence). Applications using the method should be prepared to handle this condition.

  Begins an asynchronous operation to accept an incoming connection attempt.

  Returns true if the I/O operation is pending. The event on the parameter will be raised upon completion of the operation.

  Returns false if the I/O operation completed synchronously. The event on the parameter will not be raised and the object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.

  The object to use for this asynchronous socket operation.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Net.Sockets.AddressFamily

  One of the values defined in the enumeration.

  The specifies the addressing scheme that an instance of the class can use. This property is read-only and is set when the is created.

  Gets the address family of the .

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32

  A containing the number of bytes of data that are available to be read.

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  If you are using a non-blocking , is a good way to determine whether data is queued for reading, before calling . The available data is the total amount of data queued in the network buffer for reading. If no data is queued in the network buffer, returns 0.

  If the remote host shuts down or closes the connection, can throw a . If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Gets the amount of data that has been received from the network and is available to be read.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` An error occurred while accepting the connection.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  The following excerpt from the class overview example outlines an asynchronous accept operation.

  `public class Server { static void Main() { . . . listenSocket.BeginAccept( new AsyncCallback(Server.acceptCallback), listenSocket); . . . // EndAccept can be called here . . . } public static void acceptCallback(IAsyncResult asyncAccept) { Socket listenSocket = (Socket)asyncAccept.AsyncState; Socket serverSocket = listenSocket.EndAccept(asyncAccept); serverSocket.BeginReceive(...); . . . } }`

  Connection-oriented protocols can use the method to asynchronously process incoming connection attempts. Accepting connections asynchronously gives you the ability to send and receive data within a separate execution thread. Before calling the method, you must call the method to listen for and queue incoming connection requests.

  You must create a callback method that implements the delegate and pass its name to the method. To do this, at the very minimum, you must pass the listening object to through the parameter. If your callback needs more information, you can create a small class to hold the and the other required information. Pass an instance of this class to the method through the parameter.

  Your callback method should invoke the method. When your application calls , the system usually uses a separate thread to execute the specified callback method and blocks on until a pending connection is retrieved. will return a new object that you can use to send and receive data with the remote host. You cannot use this returned to accept any additional connections from the connection queue. If you want the original thread to block after you call the method, use . Call the Set method on a in the callback method when you want the original thread to continue executing.

  The system may also use the calling thread to invoke the callback method. In this case, the property on the returned will be set to indicate that the method completed synchronously.

  For additional information on writing callback methods see [<topic://cpconcallbacksample>].

  To cancel a pending call to the method, close the . When the method is called while an asynchronous operation is in progress, the callback provided to the method is called. A subsequent call to the method will throw an to indicate that the operation has been cancelled.

  You can use the property of the returned to identify the remote host's network address and port number.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in MSDN for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Begins an asynchronous operation to accept an incoming connection attempt.

  An that references the asynchronous creation.

  The delegate. An object that contains state information for this request. 0
- Method
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` ``

  Connection-oriented protocols can use the method to asynchronously process incoming connection attempts. Accepting connections asynchronously enables you to send and receive data within a separate execution thread. This overload allows you to specify the number of bytes to accept in the initial transfer in the parameter.

  Before calling the method, you must call the method to listen for and queue incoming connection requests.

  You must create a callback method that implements the delegate and pass its name to the method. To do this, at the very minimum, you must pass the listening object to through the parameter. If your callback needs more information, you can create a small class to hold the and the other required information. Pass an instance of this class to the method through the parameter.

  Your callback method should invoke the method. When your application calls , the system usually uses a separate thread to execute the specified callback method and blocks on until a pending connection is retrieved.

  returns a new that you can use to send and receive data with the remote host. You cannot use this returned to accept any additional connections from the connection queue. If you want the original thread to block after you call the method, use . Call the Set method on a in the callback method when you want the original thread to continue executing.

  The system may also use the calling thread to invoke the callback method. In this case, the property on the returned will be set to indicate that the method completed synchronously.

  For additional information on writing callback methods see [<topic://cpconcallbacksample>].

  To cancel a pending call to the method, close the . When the method is called while an asynchronous operation is in progress, the callback provided to the method is called. A subsequent call to the method will throw an to indicate that the operation has been cancelled.

  You can call use the property of the returned object to identify the remote host's network address and port number.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Begins an asynchronous operation to accept an incoming connection attempt and receives the first block of data sent by the client application.

  An that references the asynchronous creation.

  The number of bytes to accept from the sender. The delegate. An object that contains state information for this request.
- Method
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` ``

  Connection-oriented protocols can use the method to asynchronously process incoming connection attempts. Accepting connections asynchronously gives you the ability to send and receive data within a separate execution thread. This overload allows you to specify the accepted socket in the parameter. If this parameter is null, the accepted socket is created by the method. You can specify the number of bytes to accept in the initial transfer in the parameter.

  Before calling the method, you must call the method to listen for and queue incoming connection requests.

  You must create a callback method that implements the delegate and pass its name to the method. To do this, at the very minimum, you must pass the listening object to through the parameter. If your callback needs more information, you can create a small class to hold the and the other required information. Pass an instance of this class to the method through the parameter.

  Your callback method should invoke the method. When your application calls , the system usually uses a separate thread to execute the specified callback method and blocks on until a pending connection is retrieved.

  returns a new object that you can use to send and receive data with the remote host. You cannot use this returned to accept any additional connections from the connection queue. If you want the original thread to block after you call the method, use . Call the Set method on a in the callback method when you want the original thread to continue executing.

  The system may also use the calling thread to invoke the callback method. In this case, the property on the returned will be set to indicate that the method completed synchronously.

  For additional information on writing callback methods, see [<topic://cpconcallbacksample>].

  To cancel a pending call to the method, close the . When the method is called while an asynchronous operation is in progress, the callback provided to the method is called. A subsequent call to the method will throw an to indicate that the operation has been cancelled.

  You can use the property of the returned object to identify the remote host's network address and port number.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Begins an asynchronous operation to accept an incoming connection attempt from a specified socket and receives the first block of data sent by the client application.

  An object that references the asynchronous object creation.

  The accepted object. This value may be null. The maximum number of bytes to receive. The delegate. An object that contains state information for this request.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` To be added.

  is .

  An error occurred while making the connection.

  For additional information on causes of the , see the class.

  The current instance has been disposed. A caller higher in the call stack does not have permission for the requested operation. Requires permission to make a connection to the endpoint defined by . See .

  For an outline of an asynchronous operation, see the method. For the complete example, which uses the method, see the class overview.

  If you are using a connection-oriented protocol, the method starts an asynchronous request for a connection to the parameter. If you are using a connectionless protocol, establishes a default remote host. Connecting or setting the default remote host asynchronously gives you the ability to send and receive data within a separate execution thread.

  You can create a callback method that implements the delegate and pass its name to the method. At the very minimum, you must pass the to through the parameter. If your callback needs more information, you can create a small class to hold the , and the other required information. Pass an instance of this class to the method through the parameter.

  Your callback method should invoke the method. When your application calls , the system will use a separate thread to execute the specified callback method, and will block on until the connects successfully or throws an exception. If you want the original thread to block after you call the method, use . Call the Set method on a in the callback method when you want the original thread to continue executing. For additional information on writing callback methods see [<topic://cpconcallbacksample>].

  If you are using a connectionless protocol such as UDP, you do not have to call before sending and receiving data. You can use and to communicate with a remote host. If you do call , any datagrams that arrive from an address other than the specified default will be discarded. If you wish to set your default remote host to a broadcast address, you must first call and set Broadcast to true. If you cannot, will throw a .

  If you are using a connection-oriented protocol and do not call before calling , the underlying service provider will assign the most appropriate local network address and port number. If you are using a connectionless protocol, the service provider will not assign a local network address and port number until you call the or method. If you want to change the default remote host, call the method again with the desired endpoint.

  To cancel a pending call to the method, close the . When the method is called while an asynchronous operation is in progress, the callback provided to the method is called. A subsequent call to the method will throw an to indicate that the operation has been cancelled.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  If this socket has previously been disconnected, then must be called on a thread that will not exit until the operation is complete. This is a limitation of the underlying provider.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Begins an asynchronous request for a remote host connection.

  An that references the asynchronous connection.

  The delegate. An object that contains state information for this request. 0
- Method
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` `` To be added.

  The asynchronous operation must be completed by calling the method. Typically, the method is invoked by the delegate.

  This method does not block until the operation is complete. To block until the operation is complete, use one of the method overloads, or .

  To cancel a pending call to the method, close the . When the method is called while an asynchronous operation is in progress, the callback provided to the method is called. A subsequent call to the method will throw an to indicate that the operation has been cancelled.

  For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  If this socket has previously been disconnected, then must be called on a thread that will not exit until the operation is complete. This is a limitation of the underlying provider. Also the that is used must be different.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Begins an asynchronous request for a remote host connection. The host is specified by an and a port number.

  An that references the asynchronous connection.

  The of the remote host. The port number of the remote host. A user-defined object that contains information about the connect operation. This object is passed to the delegate when the operation is complete.
- Method
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` `` To be added.

  The asynchronous operation must be completed by calling the method. Typically, the method is invoked by the delegate.

  This method does not block until the operation is complete. To block until the operation is complete, use one of the method overloads.

  To cancel a pending call to the method, close the . When the method is called while an asynchronous operation is in progress, the callback provided to the method is called. A subsequent call to the method will throw an to indicate that the operation has been cancelled.

  For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  If this socket has previously been disconnected, then must be called on a thread that will not exit until the operation is complete. This is a limitation of the underlying provider. Also the that is used must be different.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Begins an asynchronous request for a remote host connection. The host is specified by an array and a port number.

  An that references the asynchronous connections.

  At least one , designating the remote host. The port number of the remote host. A user-defined object that contains information about the connect operation. This object is passed to the delegate when the operation is complete.
- Method
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` `` To be added.

  The asynchronous operation must be completed by calling the method. Typically, the method is invoked by the delegate.

  This method does not block until the operation is complete. To block until the operation is complete, use one of the method overloads.

  To cancel a pending call to the method, close the . When the method is called while an asynchronous operation is in progress, the callback provided to the method is called. A subsequent call to the method will throw an to indicate that the operation has been cancelled.

  For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  If this socket has previously been disconnected, then must be called on a thread that will not exit until the operation is complete. This is a limitation of the underlying provider. Also the that is used must be different.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Begins an asynchronous request for a remote host connection. The host is specified by a host name and a port number.

  An that references the asynchronous connection.

  The name of the remote host. The port number of the remote host. A user-defined object that contains information about the connect operation. This object is passed to the delegate when the operation is complete.
- Method
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` ``

  If you are using a connection-oriented protocol, you can call the method to request a disconnect from a remote endpoint. If is true, you can reuse the socket.

  The method uses a separate thread to invoke the specified callback method. The method blocks until the pending disconnect is complete. For additional information on writing callback methods, see [<topic://cpconcallbacksample>].

  If you receive a exception, use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Begins an asynchronous request to disconnect from a remote endpoint.

  An object that references the asynchronous operation.

  true if this socket can be reused after the connection is closed; otherwise, false. The delegate. An object that contains state information for this request.
- Method
  2.0.0.0
  4.0.0.0
  System.CLSCompliant(false)
  System.IAsyncResult `` `` `` ``

  The asynchronous operation must be completed by calling the method. Typically, the method is invoked by the delegate.

  This method does not block until the operation is complete. To block until the operation is complete, use one of the method overloads.

  To cancel a pending , call the method.

  For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  All I/O initiated by a given thread is canceled when that thread exits. A pending asynchronous operation can fail if the thread exits before the operation completes.

  is an instantiation of a user-defined class.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Begins to asynchronously receive data from a connected .

  An that references the asynchronous read.

  An array of type that is the storage location for the received data. A bitwise combination of the values. An delegate that references the method to invoke when the operation is complete. A user-defined object that contains information about the receive operation. This object is passed to the delegate when the operation is complete.
- Method
  2.0.0.0
  4.0.0.0
  System.CLSCompliant(false)
  System.IAsyncResult `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` `` `` `` To be added. is .

  < 0.

  -or-

  > .Length.

  -or-

  < 0.

  -or-

  > .Length - .

  is not a valid combination of values.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  For an outline of an asynchronous operation, see the method. For the complete example, which uses the method, see the class overview.

  The asynchronous operation must be completed by calling the method. Typically, the method is invoked by the delegate.

  This method does not block until the operation is complete. To block until the operation is complete, use one of the method overloads.

  To cancel a pending , call the method.

  For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  All I/O initiated by a given thread is canceled when that thread exits. A pending asynchronous operation can fail if the thread exits before the operation completes.

  is an instantiation of a user-defined class.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Begins to asynchronously receive data from a connected .

  An that references the asynchronous read.

  An array of type that is the storage location for the received data. The zero-based position in the parameter at which to store the received data. The number of bytes to receive. An delegate that references the method to invoke when the operation is complete. A user-defined object that contains information about the receive operation. This object is passed to the delegate when the operation is complete. 0
- Method
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` `` `` `` `` A array to store data received from the socket. A containing the zero-based position in to begin storing the received data. A containing the number of bytes to receive. To be added. To be added. A delegate, or . An application-defined object, or .

  Begins an asynchronous operation to receive data from a socket and, for connectionless protocols, store the endpoint associated with the socket that sent the data.

  A instance that contains information about the asynchronous operation.

  To retrieve the results of the operation and release resources allocated by the method, call the method, and specify the object returned by this

  method.

  The method should be called exactly once for each call to the method.

  If the parameter is not , the method referenced by is invoked when the asynchronous operation completes. The object returned by this method is passed as the argument to the method referenced by . The method referenced by can retrieve the results of the operation by calling the method.

  The parameter can be any object that the caller wishes to have available for the duration of the asynchronous operation. This object is available via the property of the object returned by this method.

  For more information, see , the synchronous version of this method.

  is .

  -or-

  is .

  < 0.

  -or-

  > .Length.

  -or-

  < 0.

  -or-

  > .Length - .

  is not a valid combination of values.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed. A caller in the call stack does not have the required permissions.

  Requires permission to accept a connection on the endpoint defined by the property of the current instance. See .

  Requires permission to make a connection to the endpoint defined by . See .

  For an outline of an asynchronous operation, see the method. For the complete example, see .

  0
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.IAsyncResult `` `` `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` ``

  The method starts an asynchronous send operation to the remote host established in the , , , or method. will throw an exception if you do not first call , , , or . Calling the method gives you the ability to send data within a separate execution thread.

  You can create a callback method that implements the delegate and pass its name to the method. To do this, at the very minimum, your parameter must contain the connected or default being used for communication. If your callback needs more information, you can create a small class or structure to hold the and the other required information. Pass an instance of this class to the method through the parameter.

  Your callback method should invoke the method. When your application calls , the system will use a separate thread to execute the specified callback method, and will block on until the sends the number of bytes requested or throws an exception. If you want the original thread to block after you call the method, use the method. Call the Set method on a T:System.Threading.ManualResetEvent in the callback method when you want the original thread to continue executing. For additional information on writing callback methods see [<topic://cpconcallbacksample>].

  Although intended for connection-oriented protocols, also works for connectionless protocols, provided that you first call the or method to establish a default remote host. If you are using a connectionless protocol and plan to send data to several different hosts, you should use . It is okay to use even after you have established a default remote host with . You can also change the default remote host prior to calling by making another call to or . With connectionless protocols, you must also be sure that the size of your buffer does not exceed the maximum packet size of the underlying service provider. If it does, the datagram will not be sent and will throw a .

  If you specify the flag as the parameter, the data you are sending will not be routed.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  All I/O initiated by a given thread is canceled when that thread exits. A pending asynchronous operation can fail if the thread exits before the operation completes.

  is an instantiation of a user-defined class.

  The successful completion of a send does not indicate that the data was successfully delivered. If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in nonblocking mode.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Sends data asynchronously to a connected .

  An that references the asynchronous send.

  An array of type that contains the data to send. A bitwise combination of the values. The delegate. An object that contains state information for this request.
- Method
  2.0.0.0
  4.0.0.0
  System.CLSCompliant(false)
  System.IAsyncResult `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` `` `` `` To be added. is .

  < 0.

  -or-

  > .Length.

  -or-

  < 0.

  -or-

  > .Length - .

  is not a valid combination of values.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  For an outline of an asynchronous operation, see the method. For the complete example, which uses the method, see the class overview.

  The method starts an asynchronous send operation to the remote host established in the , , , or method. will throw an exception if you do not first call , , , or . Calling the method gives you the ability to send data within a separate execution thread.

  You can create a callback method that implements the delegate and pass its name to the method. To do this, at the very minimum, your parameter must contain the connected or default being used for communication. If your callback needs more information, you can create a small class or structure to hold the and the other required information. Pass an instance of this class to the method through the parameter.

  Your callback method should invoke the method. When your application calls , the system will use a separate thread to execute the specified callback method, and will block on until the sends the number of bytes requested or throws an exception. If you want the original thread to block after you call the method, use the method. Call the Set method on a T:System.Threading.ManualResetEvent in the callback method when you want the original thread to continue executing. For additional information on writing callback methods see [<topic://cpconcallbacksample>].

  Although intended for connection-oriented protocols, also works for connectionless protocols, provided that you first call the or method to establish a default remote host. If you are using a connectionless protocol and plan to send data to several different hosts, you should use . It is okay to use even after you have established a default remote host with . You can also change the default remote host prior to calling by making another call to or . With connectionless protocols, you must also be sure that the size of your buffer does not exceed the maximum packet size of the underlying service provider. If it does, the datagram will not be sent and will throw a .

  If you specify the flag as the parameter, the data you are sending will not be routed.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  All I/O initiated by a given thread is canceled when that thread exits. A pending asynchronous operation can fail if the thread exits before the operation completes.

  is an instantiation of a user-defined class.

  The successful completion of a send does not indicate that the data was successfully delivered. If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in nonblocking mode.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Sends data asynchronously to a connected .

  An that references the asynchronous send.

  An array of type that contains the data to send. The zero-based position in the parameter at which to begin sending data. The number of bytes to send. The delegate. An object that contains state information for this request. 0
- Method
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` ``

  This overload sends the file to the connected socket. If is in the local directory, it may be identified with just the name of the file; otherwise, the full path and name of the file must be specified. Wildcards ("..\\myfile.txt") and UNC share names ("\\\\shared directory\\myfile.txt") are supported. If the file is not found, the exception is thrown.

  This method uses the TransmitFile function found in the Windows Sockets 2 API. For more information about the TransmitFile function and its flags, see the Windows Sockets documentation in the MSDN Library.

  The method starts an asynchronous send operation to the remote host established in the , , , or methods. throws an exception if you do not first call , , , or . Calling the method enables you to send a file within a separate execution thread.

  To complete the operation, you can create a callback method that is invoked by the delegate parameter. To do this, at the very minimum, the parameter must contain the object being used for communication. If your callback needs more information, you can create a class or structure to hold the and the other required information. Pass an instance of this custom object to the method through the parameter.

  Your callback method must invoke the method. When your application calls , the system uses a separate thread to execute the specified callback method, and blocks on until the sends the entire file or throws an exception. For additional information on writing callback methods see [<topic://cpconcallbacksample>].

  Although intended for connection-oriented protocols, also works for connectionless protocols, provided that you first call the or method to establish a default remote host. With connectionless protocols, you must be sure that the size of your file does not exceed the maximum packet size of the underlying service provider. If it does, the datagram is not sent and throws a exception.

  If you receive a exception, use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Sends the file to a connected object using the flag.

  An object that represents the asynchronous send.

  A string that contains the path and name of the file to send. This parameter can be null. The delegate. An object that contains state information for this request.
- Method
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` `` `` ``

  This overload requires the name of the file you want to send and a bitwise combination of values. The parameter contains any data you want to precede the file. contains data you want to follow the file. If is in the local directory, it may be identified with just the name of the file; otherwise, the full path and name of the file must be specified. Wildcards ("..\\myfile.txt") and UNC share names ("\\\\shared directory\\myfile.txt") are supported. If the file is not found, the exception is thrown.

  The parameter provides the Window Sockets service provider with additional information about the file transfer. For more information about how to use this parameter, see .

  This method uses the TransmitFile function found in the Windows Sockets 2 API. For more information about the TransmitFile function and its flags, see the Windows Sockets documentation in the MSDN Library.

  The method starts an asynchronous send operation to the remote host established in the , , , or methods. throws an exception if you do not first call , , , or . Calling the method gives you the ability to send a file within a separate execution thread.

  To complete the operation, you can create a callback method that is invoked by the delegate parameter. To do this, at the very minimum, the parameter must contain the object being used for communication. If your callback needs more information, you can create a class or structure to hold the and the other required information. Pass an instance of this custom object to the method through the parameter.

  Your callback method must invoke the method. When your application calls , the system uses a separate thread to execute the specified callback method, and blocks on until the sends the entire file or throws an exception. For additional information on writing callback methods see [<topic://cpconcallbacksample>].

  Although intended for connection-oriented protocols, also works for connectionless protocols, provided that you first call the or method to establish a default remote host. With connectionless protocols, you must also be sure that the size of your file does not exceed the maximum packet size of the underlying service provider. If it does, the datagram is not sent and throws a exception.

  If you receive a exception, use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Sends a file and buffers of data asynchronously to a connected object.

  An object that represents the asynchronous operation.

  A string that contains the path and name of the file to be sent. This parameter can be null. A array that contains data to be sent before the file is sent. This parameter can be null. A array that contains data to be sent after the file is sent. This parameter can be null. A bitwise combination of values. An delegate to be invoked when this operation completes. This parameter can be null. A user-defined object that contains state information for this request. This parameter can be null.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` `` `` `` `` To be added. To be added.

  is .

  -or-

  is .

  < 0.

  -or-

  > .Length.

  -or-

  < 0.

  -or-

  > .Length - .

  is not a valid combination of values.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed. A caller in the call stack does not have the required permissions.

  Requires permission to make a connection to the endpoint defined by . See .

  For an outline of an asynchronous operation, see the method. For the complete example, see the class overview.

  The method starts an asynchronous send operation to the remote host specified in the parameter. Calling the method gives you the ability to send data within a separate execution thread. Although intended for connectionless protocols, works with both connectionless and connection-oriented protocols.

  You can create a callback method that implements the delegate and pass its name to the method. To do this, at the very minimum, your parameter must contain the connected or default being used for communication. If your callback needs more information, you can create a small class to hold the , and the other required information. Pass an instance of this class to the method through the parameter.

  Your callback method should invoke the method. When your application calls , the system will use a separate thread to execute the specified callback method, and will block on until the sends the number of bytes requested or throws an exception. If you want the original thread to block after you call the method, use the method. Call the Set method on a T:System.Threading.ManualResetEvent in the callback method when you want the original thread to continue executing. For additional information about writing callback methods see [<topic://cpconcallbacksample>].

  If you are using a connection-oriented protocol, you must first call the , , , or method, or will throw a . will ignore the parameter and send data to the established in the , , , or method.

  If you are using a connectionless protocol, you do not need to establish a default remote host with the or method prior to calling . You only need to do this if you intend to call the method. If you do call the or method prior to calling , the parameter will override the specified default remote host for that send operation only. You are also not required to call the method. In this case, the underlying service provider will assign the most appropriate local network address and port number. Use a port number of zero if you want the underlying service provider to select a free port. If you need to identify the assigned local network address and port number, you can use the property after the method successfully completes.

  If you want to send data to a broadcast address, you must first call the method and set the socket option to . -You must also be sure that the size of your buffer does not exceed the maximum packet size of the underlying service provider. If it does, the datagram will not be sent and will throw a .

  If you specify the flag as the parameter, the data you are sending will not be routed.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The execution context (the security context, the impersonated user, and the calling context) is cached for the asynchronous methods. After the first use of a particular context (a specific asynchronous method, a specific instance, and a specific callback), subsequent uses of that context will see a performance improvement.

  Sends data asynchronously to a specific remote host.

  An that references the asynchronous send.

  An array of type that contains the data to send. The zero-based position in at which to begin sending data. The number of bytes to send. The delegate. An object that contains state information for this request. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void ``

  The local to be associated with the socket.

  is . An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed. A caller in the call stack does not have the required permission. Requires permission to accept connections on the endpoint defined by . See .

  Use the method if you need to use a specific local endpoint. You must call before you can call the method. You do not need to call before using the method unless you need to use a specific local endpoint. You can use the method on both connectionless and connection-oriented protocols.

  Before calling , you must first create the local from which you intend to communicate data. If you do not care which local address is assigned, you can create an using as the address parameter, and the underlying service provider will assign the most appropriate network address. This might help simplify your application if you have multiple network interfaces. If you do not care which local port is used, you can create an using 0 for the port number. In this case, the service provider will assign an available port number between 1024 and 5000.

  If you use the above approach, you can discover what local network address and port number has been assigned by calling the . If you are using a connection-oriented protocol, will not return the locally assigned network address until after you have made a call to the or method. If you are using a connectionless protocol, you will not have access to this information until you have completed a send or receive.

  If a UDP socket wants to receive interface information on received packets, the method should be explicitly called with the socket option set to immediately after calling the method.

  If you intend to receive multicast datagrams, you must call the method with a multicast port number.

  You must call the method if you intend to receive connectionless datagrams using the method.

  If you receive a when calling the method, use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Associates a with a local endpoint.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  indicates that the current instance is in blocking mode; indicates that the current instance is in non-blocking mode.

  The current instance has been disposed.

  The property indicates whether a is in blocking mode.

  If you are in blocking mode, and you make a method call which does not complete immediately, your application will block execution until the requested operation completes. If you want execution to continue even though the requested operation is not complete, change the property to false. The property has no effect on asynchronous methods. If you are sending and receiving data asynchronously and want to block execution, use the class.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Gets or sets a value that indicates whether the is in blocking mode.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  The method closes the remote host connection and releases all managed and unmanaged resources associated with the . Upon closing, the property is set to false.

  For connection-oriented protocols, it is recommended that you call before calling the method. This ensures that all data is sent and received on the connected socket before it is closed.

  If you need to call without first calling , you can ensure that data queued for outgoing transmission will be sent by setting the option to false and specifying a non-zero time-out interval. will then block until this data is sent or until the specified time-out expires. If you set to false and specify a zero time-out interval, releases the connection and automatically discards outgoing queued data.

  To set the socket option to false, create a , set the enabled property to true, and set the property to the desired time out period. Use this along with the socket option to call the method.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Closes the connection and releases all associated resources.

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Void ``

  The method closes the remote host connection and releases all managed and unmanaged resources associated with the . Upon closing, the property is set to false.

  For connection-oriented protocols, it is recommended that you call before calling . This ensures that all data is sent and received on the connected socket before it is closed.

  If you need to call without first calling , you can ensure that data queued for outgoing transmission will be sent by setting the option to false and specifying a non-zero time-out interval. will then block until this data is sent or until the specified time-out expires. If you set to false and specify a zero time-out interval, releases the connection and automatically discards outgoing queued data.

  To set the socket option to false, create a , set the enabled property to true, and set the property to the desired time-out period. Use this along with the socket option to call the method.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Closes the connection and releases all associated resources with a specified timeout to allow queued data to be sent.

  Wait up to seconds to send any remaining data, then close the socket.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` is .

  An asynchronous call is pending and a blocking method has been called.

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed. A caller in the call stack does not have the required permission. Requires permission to make a connection to the endpoint defined by . See .

  If you are using a connection-oriented protocol such as TCP, the method synchronously establishes a network connection between and the specified remote endpoint. If you are using a connectionless protocol, establishes a default remote host. After you call , you can send data to the remote device with the method, or receive data from the remote device with the method.

  If you are using a connectionless protocol such as UDP, you do not have to call before sending and receiving data. You can use and to synchronously communicate with a remote host. If you do call , any datagrams that arrive from an address other than the specified default will be discarded. If you want to set your default remote host to a broadcast address, you must first call the method and set the socket option to , or will throw a . If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  The method will block, unless you specifically set the property to false prior to calling . If you are using a connection-oriented protocol like TCP and you do disable blocking, will throw a because it needs time to make the connection. Connectionless protocols will not throw an exception because they simply establish a default remote host. You can use to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error. If the error returned WSAEWOULDBLOCK, the remote host connection has been initiated by a connection-oriented , but has not yet completed successfully. Use the method to determine when the is finished connecting.

  If you are using a connection-oriented protocol and did not call before calling , the underlying service provider will assign the local network address and port number. If you are using a connectionless protocol, the service provider will not assign a local network address and port number until you complete a send or receive operation. If you want to change the default remote host, call again with the desired endpoint.

  If the socket has been previously disconnected, then you cannot use this method to restore the connection. Use one of the asynchronous methods to reconnect. This is a limitation of the underlying provider.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Establishes a connection to a remote host.

  An that represents the remote device. 0
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  If you are using a connection-oriented protocol such as TCP, the method synchronously establishes a network connection between and the specified remote endpoint. If you are using a connectionless protocol, establishes a default remote host. After you call you can send data to the remote device with the method, or receive data from the remote device with the method.

  If you are using a connectionless protocol such as UDP, you do not have to call before sending and receiving data. You can use and to synchronously communicate with a remote host. If you do call any datagrams that arrive from an address other than the specified default will be discarded. If you want to set your default remote host to a broadcast address, you must first call the method and set the socket option to , or will throw a . If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  method will block, unless you specifically set the property to false prior to calling . If you are using a connection-oriented protocol like TCP and you do disable blocking, will throw a because it needs time to make the connection. Connectionless protocols will not throw an exception because they simply establish a default remote host. You can use to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error. If the error returned WSAEWOULDBLOCK, the remote host connection has been initiated by a connection-oriented , but has not yet completed successfully. Use the method to determine when the is finished connecting.

  If you are using a connection-oriented protocol and did not call before calling , the underlying service provider will assign the local network address and port number. If you are using a connectionless protocol, the service provider will not assign a local network address and port number until you complete a send or receive operation. If you want to change the default remote host, call again with the desired endpoint.

  If the socket has been previously disconnected, then you cannot use this method to restore the connection. Use one of the asynchronous methods to reconnect. This is a limitation of the underlying provider.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Establishes a connection to a remote host. The host is specified by an IP address and a port number.

  The IP address of the remote host. The port number of the remote host.
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  This method is typically used immediately after a call to , which can return multiple IP addresses for a single host. If you are using a connection-oriented protocol such as TCP, the method synchronously establishes a network connection between and the specified remote endpoint. If you are using a connectionless protocol, establishes a default remote host. After you call you can send data to the remote device with the method, or receive data from the remote device with the method.

  If you are using a connectionless protocol such as UDP, you do not have to call before sending and receiving data. You can use and to synchronously communicate with a remote host. If you do call any datagrams that arrive from an address other than the specified default will be discarded. If you want to set your default remote host to a broadcast address, you must first call the method and set the socket option to , or will throw a . If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  method will block, unless you specifically set the property to false prior to calling . If you are using a connection-oriented protocol like TCP and you do disable blocking, will throw a because it needs time to make the connection. Connectionless protocols will not throw an exception because they simply establish a default remote host. You can use to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error. If the error returned WSAEWOULDBLOCK, the remote host connection has been initiated by a connection-oriented , but has not yet completed successfully. Use the method to determine when the is finished connecting.

  If you are using a connection-oriented protocol and did not call before calling , the underlying service provider will assign the local network address and port number. If you are using a connectionless protocol, the service provider will not assign a local network address and port number until you complete a send or receive operation. If you want to change the default remote host, call again with the desired endpoint.

  If the socket has been previously disconnected, then you cannot use this method to restore the connection. Use one of the asynchronous methods to reconnect. This is a limitation of the underlying provider.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Establishes a connection to a remote host. The host is specified by an array of IP addresses and a port number.

  The IP addresses of the remote host. The port number of the remote host.
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  If you are using a connection-oriented protocol such as TCP, the method synchronously establishes a network connection between and the specified remote host. If you are using a connectionless protocol, establishes a default remote host. After you call you can send data to the remote device with the method, or receive data from the remote device with the method.

  If you are using a connectionless protocol such as UDP, you do not have to call before sending and receiving data. You can use and to synchronously communicate with a remote host. If you do call any datagrams that arrive from an address other than the specified default will be discarded. If you want to set your default remote host to a broadcast address, you must first call the method and set the socket option to , or will throw a . If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  method will block, unless you specifically set the property to false prior to calling . If you are using a connection-oriented protocol like TCP and you do disable blocking, will throw a because it needs time to make the connection. Connectionless protocols will not throw an exception because they simply establish a default remote host. You can use to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error. If the error returned WSAEWOULDBLOCK, the remote host connection has been initiated by a connection-oriented , but has not yet completed successfully. Use the method to determine when the is finished connecting.

  If IPv6 is enabled and the method is called to connect to a host that resolves to both IPv6 and IPv4 addresses, the connection to the IPv6 address will be attempted first before the IPv4 address. This may have the effect of delaying the time to establish the connection if the host is not listening on the IPv6 address.

  If you are using a connection-oriented protocol and did not call before calling , the underlying service provider will assign the local network address and port number. If you are using a connectionless protocol, the service provider will not assign a local network address and port number until you complete a send or receive operation. If you want to change the default remote host, call again with the desired endpoint.

  If the socket has been previously disconnected, then you cannot use this method to restore the connection. Use one of the asynchronous methods to reconnect. This is a limitation of the underlying provider.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Establishes a connection to a remote host. The host is specified by a host name and a port number.

  The name of the remote host. The port number of the remote host.
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  If you are using a connection-oriented protocol, the method starts an asynchronous request for a connection to the remote host. If you are using a connectionless protocol, establishes a default remote host.

  To be notified of completion, you must create a callback method that implements the EventHandler<SocketAsyncEventArgs> delegate and attach the callback to the event.

  The caller must set the property to the of the remote host to connect to.

  The caller may set the property to any user state object desired before calling the method, so that the information will be retrievable in the callback method. If the callback needs more information than a single object, a small class can be created to hold the other required state information as members.

  If you are using a connectionless protocol such as UDP, you do not have to call before sending and receiving data. You can use and to communicate with a remote host. If you do call , any datagrams that arrive from an address other than the specified default will be discarded. If you want to change the default remote host, call the method again with the desired endpoint.

  If you wish to set the default remote host to a broadcast address, you must first call and set Broadcast to true. If this is not done, the method will throw a .

  The following properties and events on the object are required:

  Optionally, a buffer may be provided which will atomically be sent on the socket after the method succeeds. In this case, the property needs to be set to the buffer containing the data to send and the property needs to be set to the number of bytes of data to send from the buffer. Once a connection is established, this buffer of data is sent.

  If you are using a connection-oriented protocol and do not call before calling , the underlying service provider will assign the most appropriate local network address and port number.

  If you are using a connectionless protocol, the service provider will not assign a local network IP address and port number until you call the or methods.

  The method throws if the address family of the and the are not the same address family.

  If you receive a when calling this method, use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  Begins an asynchronous request for a connection to a remote host.

  Returns true if the I/O operation is pending. The event on the parameter will be raised upon completion of the operation.

  Returns false if the I/O operation completed synchronously. In this case, The event on the parameter will not be raised and the object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.

  The object to use for this asynchronous socket operation.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  indicates that the current instance was connected at the time of the last I/O operation; indicates that the current instance is not connected.

  The Connected property gets the connection state of the as of the last I/O operation. When it returns false, the was either never connected, or is no longer connected.

  The value of the property reflects the state of the connection as of the most recent operation. If you need to determine the current state of the connection, make a nonblocking, zero-byte Send call. If the call returns successfully or throws a WAEWOULDBLOCK error code (10035), then the socket is still connected; otherwise, the socket is no longer connected.

  If you call on a User Datagram Protocol (UDP) socket, the property always returns true; however, this action does not change the inherent connectionless nature of UDP.

  Gets a value that indicates whether a is connected to a remote host as of the last or operation.

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Void ``

  If you are using a connection-oriented protocol, you can use this method to close the socket. This method ends the connection and sets the property to false. However, if is true, you can reuse the socket.

  To ensure that all data is sent and received before the socket is closed, you should call before calling the method.

  If you need to call without first calling , you can set the option to false and specify a nonzero time-out interval to ensure that data queued for outgoing transmission is sent. then blocks until the data is sent or until the specified time-out expires. If you set to false and specify a zero time-out interval, releases the connection and automatically discards outgoing queued data.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Closes the socket connection and allows reuse of the socket.

  true if this socket can be reused after the current connection is closed; otherwise, false.
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  When using a connection-oriented protocol, calling the method requests a disconnect from a remote endpoint. If you set to true in the parameter, the socket can be reused.

  Begins an asynchronous request to disconnect from a remote endpoint.

  Returns true if the I/O operation is pending. The event on the parameter will be raised upon completion of the operation.

  Returns false if the I/O operation completed synchronously. In this case, The event on the parameter will not be raised and the object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.

  The object to use for this asynchronous socket operation.
- Method
  4.0.0.0
  System.Void

  Call Dispose when you are finished using the . The Dispose method leaves the in an unusable state. After calling Dispose, you must release all references to the so the garbage collector can reclaim the memory that the was occupying.

  For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.

  Always call Dispose before you release your last reference to the . Otherwise, the resources it is using will not be freed until the garbage collector calls the object's Finalize method.

  Releases all resources used by the current instance of the class.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void ``

  This method is called by the public Dispose() method and the method. Dispose() invokes the protected Dispose(Boolean) method with the parameter set to true. invokes Dispose with set to false.

  When the parameter is true, this method releases all resources held by any managed objects that this references. This method invokes the Dispose() method of each referenced object.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Releases the unmanaged resources used by the , and optionally disposes of the managed resources.

  true to release both managed and unmanaged resources; false to releases only unmanaged resources. 0
- Property
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  Datagrams require fragmentation when their size exceeds the Maximum Transfer Unit (MTU) of the transmission medium. Datagrams may be fragmented by the sending host (all Internet Protocol versions) or an intermediate router (Internet Protocol Version 4 only). If a datagram must be fragmented, and the option is set, the datagram is discarded, and an Internet Control Message Protocol (ICMP) error message is sent back to the sender of the datagram.

  Setting this property on a Transmission Control Protocol (TCP) socket will have no effect.

  Gets or sets a value that specifies whether the allows Internet Protocol (IP) datagrams to be fragmented.

- Method
  2.0.0.0
  4.0.0.0
  System.MonoLimitation("We do not support passing sockets across processes, we merely allow this API to pass the socket across AppDomains")
  System.Net.Sockets.SocketInformation ``

  The target process should use to create the duplicate socket instance.

  If you call the constructor multiple times with the same byte array as the argument for each call, you will create multiple managed instances with the same underlying socket. This practice is strongly discouraged.

  If the process creating the socket uses asynchronous methods ( or ), the process must first set the property to true; otherwise, the socket is bound to the completion port of the creating process, which may cause an to be thrown on the target process.

  Duplicates the socket reference for the target process, and closes the socket for this process.

  The socket reference to be passed to the target process.

  The ID of the target process where a duplicate of the socket reference is created.
- Property
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  Broadcasting is limited to a specific subnet, and must use User Datagram Protocol (UDP.) For Internet Protocol version 4, you can broadcast to your local subnet by sending a packet to 255.255.255.255; or you can use the directed broadcast address, which is the network portion of an Internet Protocol (IP) address with all bits set in the host portion. For example, if your IP address is 192.168.1.40 (a Class C address, with a netmask of 255.255.255.0 -- the network portion is the first three octets, and the host portion is the last octet), your directed broadcast address is 192.168.1.255.

  Setting this property on a Transmission Control Protocol (TCP) socket will have no effect.

  Gets or sets a value that specifies whether the can send or receive broadcast packets.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Net.Sockets.Socket `` A object that holds the state information for the asynchronous operation. is . was not returned by the current instance from a call to the method. was previously called for this operation. An error occurred during the operation.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  For an outline of an asynchronous operation, see the method. For the complete example, which uses the method, see the class overview.

  completes a call to . Before calling , you need to create a callback method that implements the delegate. This callback method executes in a separate thread, and is called by the system after the method returns. It must accept the parameter returned from the method.

  Within the callback method, call the method of the parameter to obtain the on which the connection attempt is being made. After obtaining the , you can call the method to successfully complete the connection attempt.

  The method blocks until a connection is pending in the incoming connection queue. The method accepts the incoming connection and returns a new that can be used to send data to and receive data from the remote host.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Asynchronously accepts an incoming connection attempt and creates a new to handle remote host communication.

  A to handle communication with the remote host.

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Net.Sockets.Socket `` `` To be added. To be added. To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Net.Sockets.Socket `` `` `` To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` A object that holds the state information for the asynchronous operation. is . was not returned by the current instance from a call to the method. was previously called for this operation. An error occurred during the operation.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  For an outline of an asynchronous operation, see the method. For the complete example, which uses the method, see the class overview.

  is a blocking method that completes the asynchronous remote host connection request started in the method.

  Before calling , you need to create a callback method that implements the delegate. This callback method executes in a separate thread and is called by the system after returns. The callback method must accept the returned by the method as a parameter.

  Within the callback method, call the method of the parameter to obtain the on which the connection attempt is being made. After obtaining the , you can call the method to successfully complete the connection attempt.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Ends a pending asynchronous connection request.

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Void ``

  completes a call to . The method blocks until the disconnect completes. For information about asynchronous operations, see the Asynchronous Programming Overview topic in the MSDN library.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Ends a pending asynchronous disconnect request.

  An object that stores state information and any user-defined data for this asynchronous operation.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  A object that holds the state information for the asynchronous operation.

  is . was not returned by the current instance from a call to the method. was previously called for this operation. An error occurred during the operation.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  For an outline of an asynchronous operation, see the method. For the complete example, which uses the method, see the class overview.

  The method completes the asynchronous read operation started in the method.

  Before calling , you need to create a callback method that implements the delegate. This callback method executes in a separate thread and is called by the system after returns. The callback method must accept the returned by the method as a parameter.

  Within the callback method, call the method of the to obtain the state object passed to the method. Extract the receiving from this state object. After obtaining the , you can call the method to successfully complete the read operation and return the number of bytes read.

  The method will block until data is available. If you are using a connectionless protocol, will read the first enqueued datagram available in the incoming network buffer. If you are using a connection-oriented protocol, the method will read as much data as is available up to the number of bytes you specified in the parameter of the method. If the remote host shuts down the connection with the method, and all available data has been received, the method will complete immediately and return zero bytes.

  To obtain the received data, call the method of the , and extract the buffer contained in the resulting state object.

  To cancel a pending , call the method.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  All I/O initiated by a given thread is canceled when that thread exits. A pending asynchronous operation can fail if the thread exits before the operation completes.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Ends a pending asynchronous read.

  The number of bytes received.

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` To be added. To be added. To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` To be added. To be added.

  Ends an asynchronous call to receive data from a socket and store the endpoint associated with the socket that sent the data.

  A containing the number of bytes received.

  This method blocks if the asynchronous operation has not completed.

  The method completes an asynchronous request that was started with a call to the method. The object specified for the parameter is required to be the same object as was returned by the method call that began the request.

  If the method is invoked via the delegate specified to the method, the parameter is the argument passed to the delegate's method.

  is . was not returned by the current instance from a call to the method. was previously called for this operation. An error occurred during the operation.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  For an outline of an asynchronous operation, see the method. For the complete example, see the class overview.

  0
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Int32 `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  A object that holds the state information for the asynchronous operation.

  is . was not returned by the current instance from a call to the method. was previously called for this operation. An error occurred during the operation.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  For an outline of an asynchronous operation, see the method. For the complete example, which uses the method, see the class overview.

  completes the asynchronous send operation started in .

  Before calling , you need to create a callback method that implements the delegate. This callback method executes in a separate thread and is called by the system after returns. The callback method must accept the returned by the method as a parameter.

  Within the callback method, call the method of the parameter to obtain the sending . After obtaining the , you can call the method to successfully complete the send operation and return the number of bytes sent.

  If you are using a connectionless protocol, will block until the datagram is sent. If you are using a connection-oriented protocol, will block until some of the buffer was sent. If the return value from indicates that the buffer was not completely sent, call the method again, modifying the buffer to hold the unsent data.

  There is no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  All I/O initiated by a given thread is canceled when that thread exits. A pending asynchronous operation can fail if the thread exits before the operation completes.

  The successful completion of a send does not indicate that the data was successfully delivered. If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in nonblocking mode.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Ends a pending asynchronous send.

  If successful, the number of bytes sent to the ; otherwise, an invalid error.

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` To be added. To be added. To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Void ``

  completes the asynchronous send operation started in .

  Before calling , you must create a callback method that implements the delegate. This callback method executes in a separate thread and is called by the system after returns. The callback method must accept the object returned by the method as a parameter.

  Within the callback method, call the method of the parameter to obtain the sending . After obtaining the , you can call the method to successfully complete the send operation.

  If you are using a connectionless protocol, blocks until the datagram is sent. If you are using a connection-oriented protocol, blocks until the entire file is sent. There is no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Ends a pending asynchronous send of a file.

  An object that stores state information for this asynchronous operation.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  A object that holds the state information for the asynchronous operation.

  is . was not returned by the current instance from a call to the method. was previously called for this operation. An error occurred during the operation.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  For an outline of an asynchronous operation, see the method. For the complete example, see the class overview.

  completes the asynchronous send operation started in .

  Before calling , you need to create a callback method that implements the delegate. This callback method executes in a separate thread and is called by the system after returns. The callback method must accept the returned by the method as a parameter.

  Within the callback method, call the method of the parameter to obtain the sending . After obtaining the , you can call the method to successfully complete the send operation and return the number of bytes sent.

  If you are using a connectionless protocol, will block until the datagram is sent. If you are using a connection-oriented protocol, will block until the requested number of bytes are sent. There is no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Ends a pending asynchronous send to a specific location.

  If successful, the number of bytes sent; otherwise, an invalid error.

  0
- Property
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  If is false, multiple sockets can use the method to bind to a specific port; however only one of the sockets can perform operations on the network traffic sent to the port. If more than one socket attempts to use the method to bind to a particular port, then the one with the more specific IP address will handle the network traffic sent to that port.

  If is true, the first use of the method to attempt to bind to a particular port, regardless of Internet Protocol (IP) address, will succeed; all subsequent uses of the method to attempt to bind to that port will fail until the original bound socket is destroyed.

  This property must be set before is called; otherwise an will be thrown.

  Gets or sets a value that specifies whether the allows only one process to bind to a port.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  The class finalizer calls the method to close the and free resources associated with the .

  Frees resources used by the class.

  0
- Method
  System.Int32

  The method returns a hash code of this instance. This value can be used as a key in hash tables.

  Returns a hash value for a instance.

  An integer hash value.

  0
  1.0.5000.0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object `` `` An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  The following example gets the state of the linger option and the size of the receive buffer, changes the values of both, then gets the new values.

  `using System; using System.Net.Sockets; class OptionTest{ public static void Main() { // Get the current option values. Socket someSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); LingerOption lingerOp = (LingerOption)someSocket.GetSocketOption( SocketOptionLevel.Socket, SocketOptionName.Linger); int receiveBuffer = (int)someSocket.GetSocketOption( SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer); Console.WriteLine( "Linger option is {0} and set to {1} seconds.", lingerOp.Enabled.ToString(), lingerOp.LingerTime.ToString() ); Console.WriteLine( "Size of the receive buffer is {0} bytes.", receiveBuffer.ToString() ); // Change the options. lingerOp = new LingerOption(true, 10); someSocket.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.Linger, lingerOp); someSocket.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, 2048); Console.WriteLine( "The SetSocketOption method has been called."); // Get the new option values. lingerOp = (LingerOption)someSocket.GetSocketOption( SocketOptionLevel.Socket, SocketOptionName.Linger); receiveBuffer = (int)someSocket.GetSocketOption( SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer); Console.WriteLine( "Linger option is now {0} and set to {1} seconds.", lingerOp.Enabled.ToString(), lingerOp.LingerTime.ToString()); Console.WriteLine( "Size of the receive buffer is now {0} bytes.", receiveBuffer.ToString()); } }`

  The output is

  Linger option is False and set to 0 seconds.

  Size of the receive buffer is 8192 bytes.

  The SetSocketOption method has been called.

  Linger option is now True and set to 10 seconds.

  Size of the receive buffer is now 2048 bytes.

  options determine the behavior of the current . Use this overload to get the , , and options. For the option, use for the parameter. For and , use . If you want to set the value of any of the options listed above, use the method.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Returns the value of a specified option, represented as an object.

  An object that represents the value of the option. When the parameter is set to the return value is an instance of the class. When is set to or , the return value is an instance of the class. When is any other value, the return value is an integer.

  One of the values. One of the values. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` ``

  is too small to store the value of the specified socket option.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  options determine the behavior of the current . Upon successful completion of this method, the array specified by the parameter contains the value of the specified option.

  When the length of the array is smaller than the number of bytes required to store the value of the specified option, will throw a . If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error. Use this overload for any sockets that are represented by Boolean values or integers.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Returns the specified option setting, represented as a byte array.

  One of the values. One of the values. An array of type that is to receive the option setting. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Byte[] `` `` `` To be added.

  is smaller than the number of bytes required to store the value of the specified socket option.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  The parameter sets the maximum size of the returned byte array. If the option value requires fewer bytes, the array will contain only that many bytes. If the option value requires more bytes, will throw a . Use this overload for any sockets that are represented by Boolean values or integers.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Returns the value of the specified option in an array.

  An array of type that contains the value of the socket option.

  One of the values. One of the values. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.IntPtr

  A containing the operating system handle for the current instance.

  This property is read-only.

  Requires permission to access unmanaged code. See .

  Gets the operating system handle for the .

  1
  RuntimeInfrastructure
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` To be added. To be added. To be added.

  An attempt was made to change the blocking mode.

  Use the property to change the blocking mode.

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed. Requires permission to access unmanaged code. See .

  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.

  `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.

  A caller in the call stack does not have the required permissions.

  The method provides low-level access to the operating system underlying the current instance of the class. For more information, see the WSAIoctl documentation in the MSDN library.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sets low-level operating modes for the using numerical control codes.

  The number of bytes in the parameter.

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` ``

  This method provides low-level access to the operating system underlying the current instance of the class. For more, see the WSAIoctl documentation in the MSDN library.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sets low-level operating modes for the using the enumeration to specify control codes.

  The number of bytes in the parameter.

  A value that specifies the control code of the operation to perform. An array of type that contains the input data required by the operation. An array of type that contains the output data returned by the operation.
- Property
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  A socket is considered bound to a local port if it is explicitly bound by calling the method, or implicitly bound by calling members like , , or , which use an ephemeral local port (a free port greater than 1024, selected by the operating system.) Servers use the method to bind to a well-known port so that clients may connect to them.

  Gets a value that indicates whether the is bound to a specific local port.

- Property
  2.0.0.0
  4.0.0.0
  System.Net.Sockets.LingerOption To be added.

  The property changes the way method behaves. This property when set modifies the conditions under which the connection can be reset by Winsock. Connection resets can still occur based on the IP protocol behavior.

  This property controls the length of time that a connection-oriented connection will remain open after a call to when data remains to be sent.

  When you call methods to send data to a peer, this data is placed in the outgoing network buffer. This property can be used to ensure that this data is sent to the remote host before the method drops the connection.

  To enable lingering, create a instance containing the desired values, and set the property to this instance.

  The following table describes the behavior of the method for the possible values of the property and the property stored in the property.

  LingerState.Enabled

  LingerState.LingerTime

  Behavior

  false (disabled), the default value

  The time-out is not applicable, (default).

  Attempts to send pending data until the default IP protocol time-out expires.

  true (enabled)

  A nonzero time-out

  Attempts to send pending data until the specified time-out expires, and if the attempt fails, then Winsock resets the connection.

  true (enabled)

  A zero timeout.

  Discards any pending data. For connection-oriented socket (TCP, for example), Winsock resets the connection.

  The IP stack computes the default IP protocol time-out period to use based on the round trip time of the connection. In most cases, the time-out computed by the stack is more relevant than one defined by an application. This is the default behavior for a socket when the property is not set.

  When the property stored in the property is set greater than the default IP protocol time-out, the default IP protocol time-out will still apply and override.

  Gets or sets a value that specifies whether the will delay closing a socket in an attempt to send all pending data.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` The property of the current instance is true.

  -or-

  has not been called on the current instance.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  causes a connection-oriented to listen for incoming connection attempts. The parameter specifies the number of incoming connections that can be queued for acceptance. To determine the maximum number of connections you can specify, retrieve the value. does not block.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error. Use or to accept a connection from the queue.

  You must call the method before calling , or will throw a .

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  The backlog parameter is limited to different values depending on the Operating System. You may specify a higher value, but the backlog will be limited based on the Operating System.

  Places a in a listening state.

  The maximum length of the pending connections queue. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Net.EndPoint

  The local associated with the current instance.

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  The property gets an that contains the local IP address and port number to which your is bound. You must cast this to an before retrieving any information. You can then call the method to retrieve the local , and the method to retrieve the local port number.

  The property is usually set after you make a call to the method. If you allow the system to assign your socket's local IP address and port number, the property will be set after the first I/O operation. For connection-oriented protocols, the first I/O operation would be a call to the or method. For connectionless protocols, the first I/O operation would be any of the send or receive calls.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Gets the local endpoint.

  0
- Property
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  Multicast is a scalable method for many-to-many communication on the Internet. A process subscribes to a multicast address; then, any packets sent by a subscribed process are received by every other process subscribed to the multicast address.

  Setting this property on a Transmission Control Protocol (TCP) socket will have no effect.

  Gets or sets a value that specifies whether outgoing multicast packets are delivered to the sending application.

- Property
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  The Nagle algorithm is designed to reduce network traffic by causing the socket to buffer small packets and then combine and send them in one packet under certain circumstances. A TCP packet consists of 40 bytes of header plus the data being sent. When small packets of data are sent with TCP, the overhead resulting from the TCP header can become a significant part of the network traffic. On heavily loaded networks, the congestion resulting from this overhead can result in lost datagrams and retransmissions, as well as excessive propagation time caused by congestion. The Nagle algorithm inhibits the sending of new TCP segments when new outgoing data arrives from the user if any previouslytransmitted data on the connection remains unacknowledged.

  The majority of network applications should use the Nagle algorithm.

  Setting this property on a User Datagram Protocol (UDP) socket will have no effect.

  Gets or sets a value that specifies whether the stream is using the Nagle algorithm.

- Property
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  The operating system may support both IPv4 and IPv6 protocols.

  Indicates whether the underlying operating system and network adaptors support Internet Protocol version 6 (IPv6).

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean `` `` To be added. is not one of the values defined in the enumeration.

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  The method will check the state of the . Specify for the parameter to determine if the is readable. Specify to determine if the is writable. Use to detect an error condition. will block execution until the specified time period, measured in , elapses. Set the parameter to a negative integer if you would like to wait indefinitely for a response. If you want to check the status of multiple sockets, you might prefer to use the method.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This method cannot detect certain kinds of connection problems, such as a broken network cable, or that the remote host was shut down ungracefully. You must attempt to send or receive data to detect these kinds of errors.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Determines the status of the .

  The status of the based on the polling mode value passed in the parameter.

  Mode

  Return Value

  true if has been called and a connection is pending;

  -or-

  true if data is available for reading;

  -or-

  true if the connection has been closed, reset, or terminated;

  otherwise, returns false.

  true, if processing a , and the connection has succeeded;

  -or-

  true if data can be sent;

  otherwise, returns false.

  true if processing a that does not block, and the connection has failed;

  -or-

  true if is not set and out-of-band data is available;

  otherwise, returns false.

  One of the values. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Net.Sockets.ProtocolType

  One of the values defined in the enumeration.

  The property is set when the is created, and specifies the protocol used by that .

  Gets the protocol type of the .

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` is .

  An asynchronous call is pending and a blocking method has been called.

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  A caller in the call stack does not have the required permissions. The current instance has been disposed. Requires permission to accept connections. See .

  The method reads data into the buffer parameter and returns the number of bytes successfully read. You can call from both connection-oriented and connectionless sockets.

  This overload only requires you to provide a receive buffer. The buffer offset defaults to 0, the size defaults to the length of the buffer parameter, and the value defaults to .

  If you are using a connection-oriented protocol, you must either call to establish a remote host connection, or to accept an incoming connection prior to calling . The method will only read data that arrives from the remote host established in the or method. If you are using a connectionless protocol, you can also use the method. will allow you to receive data arriving from any host.

  If no data is available for reading, the method will block until data is available, unless a time-out value was set by using . If the time-out value was exceeded, the call will throw a . If you are in non-blocking mode, and there is no data available in the in the protocol stack buffer, the method will complete immediately and throw a . You can use the property to determine if data is available for reading. When is non-zero, retry the receive operation.

  If you are using a connection-oriented , the method will read as much data as is available, up to the size of the buffer. If the remote host shuts down the connection with the method, and all available data has been received, the method will complete immediately and return zero bytes.

  If you are using a connectionless , will read the first queued datagram from the destination address you specify in the method. If the datagram you receive is larger than the size of the parameter, gets filled with the first part of the message, the excess data is lost and a is thrown.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Receives data from a bound into a receive buffer.

  The number of bytes received.

  An array of type that is the storage location for the received data. 0
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  This method reads data into the buffers parameter and returns the number of bytes successfully read. You can call from both connection-oriented and connectionless sockets.

  This overload requires you to provide one or more receive buffers.

  If you are using a connection-oriented protocol, you must either call to establish a remote host connection, or to accept an incoming connection prior to calling . The method will only read data that arrives from the remote host connection established in the or method. If you are using a connectionless protocol, you can also use the method. will allow you to receive data arriving from any host.

  If no data is available for reading, the method will block until data is available, unless a time-out value was set by using . If the time-out value was exceeded, the call will throw a . If you are in non-blocking mode, and there is no data available in the in the protocol stack buffer, the method will complete immediately and throw a . You can use the property to determine if data is available for reading. When is non-zero, retry the receive operation.

  If you are using a connection-oriented , the method will read as much data as is available, up to the size of the buffer. If the remote host shuts down the connection with the method, and all available data has been received, the method will complete immediately and return zero bytes.

  If you are using a connectionless , will read the first enqueued datagram from the destination address you specify in the method. If the datagram you receive is larger than the size of the parameter, gets filled with the first part of the message, the excess data is lost and a is thrown.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  Note This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Receives data from a bound into the list of receive buffers.

  The number of bytes received.

  A list of s of type that contains the received data.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` To be added. is .

  An asynchronous call is pending and a blocking method has been called.

  is not a valid combination of values.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class. A caller in the call stack does not have the required permissions. The current instance has been disposed. Requires permission to accept connections. See .

  The method reads data into the buffer parameter and returns the number of bytes successfully read. You can call from both connection-oriented and connectionless sockets.

  This overload only requires you to provide a receive buffer and the necessary . The buffer offset defaults to 0, and the size defaults to the length of the byte parameter.

  If you are using a connection-oriented protocol, you must either call to establish a remote host connection, or to accept an incoming connection prior to calling . The method will only read data that arrives from the remote host established in the or method. If you are using a connectionless protocol, you can also use the method. will allow you to receive data arriving from any host.

  If no data is available for reading, the method will block until data is available. If you are in non-blocking mode, and there is no data available in the protocol stack buffer, the method will complete immediately and throw a . You can use the property to determine if data is available for reading. When is non-zero, retry your receive operation.

  If you are using a connection-oriented , the method will read as much data as is available up to the size of the buffer. If the remote host shuts down the connection with the method, and all available data has been received, the method will complete immediately and return zero bytes.

  If you are using a connectionless , will read the first enqueued datagram from the destination address you specify in the method. If the datagram you receive is larger than the size of the parameter, gets filled with the first part of the message, the excess data is lost and a is thrown.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Receives data from a bound into a receive buffer, using the specified .

  The number of bytes received.

  An array of type that is the storage location for the received data. 0
- Method
  2.0.0.0
  4.0.0.0
  System.CLSCompliant(false)
  System.Int32 `` ``

  This method reads data into the parameter and returns the number of bytes successfully read. You can call from both connection-oriented and connectionless sockets.

  This overload requires you to provide one or more receive buffers. The value defaults to .

  If you are using a connection-oriented protocol, you must either call to establish a remote host connection, or to accept an incoming connection prior to calling . The method will only read data that arrives from the remote host connection established in the or method. If you are using a connectionless protocol, you can also use the method. will allow you to receive data arriving from any host.

  If no data is available for reading, the method will block until data is available, unless a time-out value was set by using . If the time-out value was exceeded, the call throws a . If you are in non-blocking mode, and there is no data available in the in the protocol stack buffer, the method will complete immediately and throw a . You can use the property to determine if data is available for reading. When is non-zero, retry the receive operation.

  If you are using a connection-oriented , the method will read as much data as is available, up to the size of the buffer. If the remote host shuts down the connection with the method, and all available data has been received, the method will complete immediately and return zero bytes.

  If you are using a connectionless , will read the first enqueued datagram from the destination address you specify in the method. If the datagram you receive is larger than the size of the parameter, gets filled with the first part of the message, the excess data is lost and a is thrown.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Receives data from a bound into the list of receive buffers, using the specified .

  The number of bytes received.

  A list of s of type that contains the received data. A bitwise combination of the values.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` To be added. is .

  < 0.

  -or-

  > .Length.

  An asynchronous call is pending and a blocking method has been called.

  is not a valid combination of values.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  A caller in the call stack does not have the required permissions. The current instance has been disposed. Requires permission to accept connections. See .

  The method reads data into the parameter and returns the number of bytes successfully read. You can call from both connection-oriented and connectionless sockets.

  This overload only requires you to provide a receive buffer, the number of bytes you want to receive, and the necessary .

  If you are using a connection-oriented protocol, you must either call to establish a remote host connection, or to accept an incoming connection prior to calling . The method will only read data that arrives from the remote host established in the or method. If you are using a connectionless protocol, you can also use the method. will allow you to receive data arriving from any host.

  If no data is available for reading, the method will block until data is available, unless a time-out value was set by using . If the time-out value was exceeded, the call will throw a . If you are in non-blocking mode, and there is no data available in the in the protocol stack buffer, The method will complete immediately and throw a . You can use the property to determine if data is available for reading. When is non-zero, retry your receive operation.

  If you are using a connection-oriented , the method will read as much data as is available, up to the number of bytes specified by the parameter. If the remote host shuts down the connection with the method, and all available data has been received, the method will complete immediately and return zero bytes.

  If you are using a connectionless , will read the first queued datagram from the destination address you specify in the method. If the datagram you receive is larger than the size of the parameter, gets filled with the first part of the message, the excess data is lost and a is thrown.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Receives the specified number of bytes of data from a bound into a receive buffer, using the specified .

  The number of bytes received.

  An array of type that is the storage location for the received data. The number of bytes to receive. 0
- Method
  2.0.0.0
  4.0.0.0
  System.CLSCompliant(false)
  System.Int32 `` `` `` To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` `` To be added. is .

  < 0.

  -or-

  > .Length.

  -or-

  < 0.

  -or-

  > .Length - .

  An asynchronous call is pending and a blocking method has been called.

  is not a valid combination of values.

  -or-

  The property was not set.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  A caller in the call stack does not have the required permissions. The current instance has been disposed.

  Requires permission to accept a connection on the endpoint defined by the property of the current instance. See .

  The method reads data into the buffer parameter and returns the number of bytes successfully read. You can call from both connection-oriented and connectionless sockets.

  If you are using a connection-oriented protocol, you must either call to establish a remote host connection, or to accept an incoming connection prior to calling . The method will only read data that arrives from the remote host established in the or method. If you are using a connectionless protocol, you can also use the method. will allow you to receive data arriving from any host.

  If no data is available for reading, the method will block until data is available, unless a time-out value was set by using . If the time-out value was exceeded, the call will throw a . If you are in non-blocking mode, and there is no data available in the in the protocol stack buffer, the method will complete immediately and throw a . An error occurred when attempting to access the socket. See Remarks below. You can use the property to determine if data is available for reading. When is non-zero, retry the receive operation.

  If you are using a connection-oriented , the method will read as much data as is available, up to the number of bytes specified by the size parameter. If the remote host shuts down the connection with the method, and all available data has been received, the method will complete immediately and return zero bytes.

  If you are using a connectionless , will read the first queued datagram from the destination address you specify in the method. If the datagram you receive is larger than the size of the parameter, gets filled with the first part of the message, the excess data is lost and a is thrown.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Receives the specified number of bytes from a bound into the specified offset position of the receive buffer, using the specified .

  The number of bytes received.

  An array of type that is the storage location for received data. The location in to store the received data. The number of bytes to receive. 0
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  The method is used on connected sockets or bound connectionless sockets and is used to read incoming data. The socket's local address must be known.

  For bound connectionless sockets, this function restricts the addresses from which received messages are accepted. The function only returns messages from the remote address specified in the connection. Messages from other addresses are silently discarded.

  The property on the parameter provides the Window Sockets service provider with additional information about the read request. For more information about how to use this parameter, see .

  The following properties and events on the object are required to successfully call this method:

  or

  if is set

  if is set

  The caller may set the property to any user state object desired before calling the method, so that the information will be retrievable in the callback method. If the callback needs more information than a single object, a small class can be created to hold the other required state information as members.

  For byte stream-style sockets, incoming data is placed into the buffer until the buffer is filled, the connection is closed, or the internally buffered data is exhausted.

  For message-oriented sockets, an incoming message is placed into the buffer up to the total size of the buffer associated with the parameter. If the message is larger than the buffer, the buffer is filled with the first part of the message.

  For connection-oriented sockets, the method can indicate the graceful termination of the virtual circuit in one of two ways that depend on whether the socket is byte stream or message oriented. For byte streams, zero bytes having been read indicates graceful closure and that no more bytes will ever be read. For message-oriented sockets, where a zero byte message is often allowable, a with the set to the native Winsock WSAEDISCON error code (10101) is used to indicate graceful closure. In any case, a with the set to the native Winsock WSAECONNRESET error code (10054) indicates an abortive close has occurred.

  Begins an asynchronous request to receive data from a connected object.

  Returns true if the I/O operation is pending. The event on the parameter will be raised upon completion of the operation.

  Returns false if the I/O operation completed synchronously. In this case, The event on the parameter will not be raised and the object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.

  The object to use for this asynchronous socket operation.
- Property
  2.0.0.0
  4.0.0.0
  System.Int32 To be added.

  A larger buffer size potentially reduces the number of empty acknowledgements (TCP packets with no data portion), but might also delay the recognition of connection difficulties. Consider increasing the buffer size if you are transferring large files, or you are using a high bandwidth, high latency connection (such as a satellite broadband provider.)

  Gets or sets a value that specifies the size of the receive buffer of the .

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` To be added. To be added.

  Receives data from a socket and, for connectionless protocols, stores the endpoint associated with the socket that sent the data.

  A containing the number of bytes received.

  This method is equivalent to (, 0, .Length, , ).

  or is .

  An asynchronous call is pending and a blocking method has been called.

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed. Requires permission to accept connections from the endpoint defined by . See . 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` To be added. To be added. To be added.

  Receives data from a socket and, for connectionless protocols, stores the endpoint associated with the socket that sent the data.

  A containing the number of bytes received.

  This method is equivalent to (, 0, .Length, , ).

  or is .

  An asynchronous call is pending and a blocking method has been called.

  specified an invalid value.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  A caller in the call stack does not have the required permissions. The current instance has been disposed. Requires permission to accept connections from the endpoint defined by . See . 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` `` To be added. A containing the number of bytes to receive. To be added. To be added.

  Receives data from a socket and, for connectionless protocols, stores the endpoint associated with the socket that sent the data.

  A containing the number of bytes received.

  This method is equivalent to (, 0, , , ).

  or is .

  < 0.

  -or-

  > .Length.

  An asynchronous call is pending and a blocking method has been called.

  is not a valid combination of values.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  A caller in the call stack does not have the required permissions. The current instance has been disposed. Requires permission to accept connections from the endpoint defined by . See . 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` `` `` To be added. A containing the zero-based position in to begin storing the received data. A containing the number of bytes to receive. To be added. To be added.

  Receives data from a socket and, for connectionless protocols, stores the endpoint associated with the socket that sent the data.

  A containing the number of bytes received.

  For connectionless protocols, when this method successfully completes, contains the endpoint associated with the socket that sent the data.

  For connection-oriented protocols, is left unchanged.

  The property is required to be set before this method is called or a is thrown.

  The property of the socket determines the behavior of this method when no incoming data is available. When , the exception is thrown. When , this method blocks and waits for data to arrive.

  For socket types, if the remote socket was shut down gracefully, and all data was received, this method immediately returns zero, regardless of the blocking state.

  For message-oriented sockets, if the message is larger than the size of , the buffer is filled with the first part of the message, and the exception is thrown. For unreliable protocols, the excess data is lost; for reliable protocols, the data is retained by the service provider.

  When the flag is specified as part of theparameter and the socket is configured for in-line reception of out-of-band (OOB) data (using the socket option) and OOB data is available, only OOB data is returned.

  When the flag is specified as part of the parameter, available data is copied into but is not removed from the system buffer.

  or is .

  < 0.

  -or-

  > .Length.

  -or-

  < 0.

  -or-

  > .Length - .

  An asynchronous call is pending and a blocking method has been called.

  is not a valid combination of values.

  -or-

  The property was not set.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  A caller in the call stack does not have the required permissions. The current instance has been disposed.

  Requires permission to accept a connection on the endpoint defined by the property of the current instance. See .

  Requires permission to make a connection to the endpoint defined by . See .

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  The method is used primarily to receive data on a connectionless socket. The socket's local address must be known.

  The caller must set the property to the of the remote host from which the data is to be received.

  The property on the parameter provides the Window Sockets service provider with additional information about the read request. For more information about how to use this parameter, see .

  The following properties and events on the object are required to successfully call this method:

  The caller may set the property to any user state object desired before calling the method, so that the information will be retrievable in the callback method. If the callback needs more information than a single object, a small class can be created to hold the other required state information as members.

  For message-oriented sockets, an incoming message is placed into the buffer up to the total size of the buffer. The and properties determine where in the buffer the data is placed and the amount of data.

  For byte stream–style sockets, incoming data is placed into the buffer until the buffer is filled, the connection is closed, or the internally buffered data is exhausted. The and properties determine where in the buffer the data is placed and the amount of data.

  Begins to asynchronously receive data from a specified network device.

  Returns true if the I/O operation is pending. The event on the parameter will be raised upon completion of the operation.

  Returns false if the I/O operation completed synchronously. In this case, The event on the parameter will not be raised and the object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.

  The object to use for this asynchronous socket operation.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO("Not implemented")
  System.Int32 `` `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO("Not implemented")
  System.Boolean ``

  The method is used primarily to receive message data on a connectionless socket. The socket's local address must be known. This method can only be used with datagram and raw sockets. The socket must be initialized with the socket type set to or before calling this method. This can be done when the socket is constructed using .

  The caller must set the property to the of the remote host from which the data is to be received.

  The following properties and events on the object are required to successfully call this method:

  The caller may set the property to any user state object desired before calling the method, so that the information will be retrievable in the callback method. If the callback needs more information than a single object, a small class can be created to hold the other required state information as members.

  For message-oriented sockets, an incoming message is placed into the buffer up to the total size of the buffer. The and properties determine where in the buffer the data is placed and the amount of data.

  The method automatically sets the socket option to true the first time it is called for a given . However, the object will only be valid for packets which arrive at the local computer after the socket option has been set. If a socket is sent packets between when the socket is bound to a local endpoint (explicitly by the method or implicitly by one of the , , , or methods) and the first call to the method, calls to method will result in invalid objects for these packets.

  To ensure that all objects are valid, an application should set the socket option to true before it is bound to a local endpoint using the method.

  An application can examine the resulting objects if it needs to know if the datagram was sent using a unicast, multicast, or broadcast address.

  Begins to asynchronously receive the specified number of bytes of data into the specified location in the data buffer, using the specified , and stores the endpoint and packet information.

  Returns true if the I/O operation is pending. The event on the parameter will be raised upon completion of the operation.

  Returns false if the I/O operation completed synchronously. In this case, The event on the parameter will not be raised and the object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.

  The object to use for this asynchronous socket operation.
- Property
  2.0.0.0
  4.0.0.0
  System.Int32 To be added.

  This option applies to synchronous calls only. If the time-out period is exceeded, the method will throw a .

  Gets or sets a value that specifies the amount of time after which a synchronous call will time out.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Net.EndPoint

  The remote associated with the current instance.

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  If you are using a connection-oriented protocol, the property gets the that contains the remote IP address and port number to which the is connected. If you are using a connectionless protocol, contains the default remote IP address and port number with which the will communicate. You must cast this to an before retrieving any information. You can then call the method to retrieve the remote , and the method to retrieve the remote port number.

  The is set after a call to either or . If you try to access this property earlier, will throw a . If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Gets the remote endpoint.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` `` All of the following parameters are or empty: , , and . An error occurred while accessing one of the sockets.

  For additional information on causes of the , see the class.

  The following example determines the status of the socket instance named socket3 and writes the result to the console.

  `using System; using System.Collections; using System.Net.Sockets; class SelectTest { public static void Main() { Socket socket1 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Socket socket2 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Socket socket3 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); ArrayList readList = new ArrayList(); ArrayList writeList = new ArrayList(); ArrayList errorList = new ArrayList(); readList.Add(socket1); readList.Add(socket2); readList.Add(socket3); errorList.Add(socket1); errorList.Add(socket3); // readList.Contains(Socket3) returns true // if Socket3 is in ReadList. Console.WriteLine( "socket3 is placed in readList and errorList."); Console.WriteLine( "socket3 is {0}in readList.", readList.Contains(socket3) ? "" : "not " ); Console.WriteLine( "socket3 is {0}in writeList.", writeList.Contains(socket3) ? "" : "not " ); Console.WriteLine( "socket3 is {0}in errorList.", errorList.Contains(socket3) ? "" : "not " ); Socket.Select(readList, writeList, errorList, 10); Console.WriteLine("The Select method has been called."); Console.WriteLine( "socket3 is {0}in readList.", readList.Contains(socket3) ? "" : "not " ); Console.WriteLine( "socket3 is {0}in writeList.", writeList.Contains(socket3) ? "" : "not " ); Console.WriteLine( "socket3 is {0}in errorList.", errorList.Contains(socket3) ? "" : "not " ); } }`

  The output is

  socket3 is placed in readList and errorList.

  socket3 is in readList.

  socket3 is not in writeList.

  socket3 is in errorList.

  The Select method has been called.

  socket3 is not in readList.

  socket3 is not in writeList.

  socket3 is not in errorList.

  is a static method that determines the status of one or more instances. You must place one or more sockets into an before you can use the method. Check for readability by calling with the as the parameter. To check your sockets for writability, use the parameter. For detecting error conditions, use . After calling , the will be filled with only those sockets that satisfy the conditions.

  If you are in a listening state, readability means that a call to will succeed without blocking. If you have already accepted the connection, readability means that data is available for reading. In these cases, all receive operations will succeed without blocking. Readability can also indicate whether the remote has shut down the connection; in that case a call to will return immediately, with zero bytes returned.

  returns when at least one of the sockets of interest (the sockets in the , , and lists) meets its specified criteria, or the parameter is exceeded, whichever comes first. Setting to -1 specifies an infinite time-out.

  If you make a nonblocking call to , writability means that you have connected successfully. If you already have a connection established, writability means that all send operations will succeed without blocking.

  If you have made a non-blocking call to , the parameter identifies sockets that have not connected successfully.

  Use the method if you only want to determine the status of a single .

  This method cannot detect certain kinds of connection problems, such as a broken network cable, or that the remote host was shut down ungracefully. You must attempt to send or receive data to detect these kinds of errors.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  Determines the status of one or more sockets.

  An of instances to check for readability. An of instances to check for writability. An of instances to check for errors. The time-out value, in microseconds. A -1 value indicates an infinite time-out. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` A array containing data to send to the socket. is .

  An asynchronous call is pending and a blocking method has been called.

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  synchronously sends data to the remote host specified in the or method and returns the number of bytes successfully sent. can be used for both connection-oriented and connectionless protocols.

  This overload requires a buffer that contains the data you want to send. The value defaults to 0, the buffer offset defaults to 0, and the number of bytes to send defaults to the size of the buffer.

  If you are using a connectionless protocol, you must call before calling this method, or will throw a . If you are using a connection-oriented protocol, you must either use to establish a remote host connection, or use to accept an incoming connection.

  If you are using a connectionless protocol and plan to send data to several different hosts, you should use the method. If you do not use the method, you will have to call before each call to . You can use even after you have established a default remote host with . You can also change the default remote host prior to calling by making another call to .

  If you are using a connection-oriented protocol, will block until all of the bytes in the buffer are sent, unless a time-out was set by using . If the time-out value was exceeded, the call will throw a . In nonblocking mode, may complete successfully even if it sends less than the number of bytes in the buffer. It is your application's responsibility to keep track of the number of bytes sent and to retry the operation until the application sends the bytes in the buffer. There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  The successful completion of a send does not indicate that the data was successfully delivered. If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in nonblocking mode.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sends data to a connected .

  The number of bytes sent to the .

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  can be used for both connection-oriented and connectionless protocols.

  This overload requires at least one buffer that contains the data you want to send.

  If you are using a connectionless protocol, you must call before calling this method, or will throw a . If you are using a connection-oriented protocol, you must either use to establish a remote host connection, or use to accept an incoming connection.

  If you are using a connectionless protocol and plan to send data to several different hosts, you should use the method. If you do not use the method, you will have to call before each call to . You can use even after you have established a default remote host with . You can also change the default remote host prior to calling by making another call to .

  If you are using a connection-oriented protocol, will block until all of the bytes in the buffer are sent, unless a time-out was set by using . If the time-out value was exceeded, the call will throw a . In nonblocking mode, may complete successfully even if it sends less than the number of bytes in the buffer. It is your application's responsibility to keep track of the number of bytes sent and to retry the operation until the application sends the bytes in the buffer. There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  The successful completion of a send does not indicate that the data was successfully delivered. If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in nonblocking mode.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sends the set of buffers in the list to a connected .

  The number of bytes sent to the .

  A list of s of type that contains the data to be sent.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` To be added. To be added. is .

  An asynchronous call is pending and a blocking method has been called.

  is not a valid combination of values.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  synchronously sends data to the remote host established in the or method and returns the number of bytes successfully sent. The method can be used for both connection-oriented and connectionless protocols.

  This overload requires a buffer that contains the data you want to send and a bitwise combination of . The buffer offset defaults to 0, and the number of bytes to send defaults to the size of the buffer. If you specify the flag as the parameter value, the data you are sending will not be routed.

  If you are using a connectionless protocol, you must call before calling this method, or will throw a . If you are using a connection-oriented protocol, you must either use to establish a remote host connection, or use to accept an incoming connection.

  If you are using a connectionless protocol and plan to send data to several different hosts, you should use the method. If you do not use the method, you will have to call the method before each call to . You can use even after you have established a default remote host with . You can also change the default remote host prior to calling by making another call to .

  If you are using a connection-oriented protocol, will block until all of the bytes in the buffer are sent, unless a time-out was set by using . If the time-out value was exceeded, the call will throw a . In nonblocking mode, may complete successfully even if it sends less than the number of bytes in the buffer. It is your application's responsibility to keep track of the number of bytes sent and to retry the operation until the application sends the requested number of bytes. There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  You must ensure that the size of your buffer does not exceed the maximum packet size of the underlying service provider. If it does, the datagram will not be sent and will throw a . If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  The successful completion of a send does not indicate that the data was successfully delivered. If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in nonblocking mode.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sends data to a connected using the specified .

  The number of bytes sent to the .

  0
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` ``

  This overload requires at least one buffer that contains the data you want to send. The value defaults to 0. If you specify the flag as the parameter, the data you are sending will not be routed.

  If you are using a connectionless protocol, you must call before calling this method, or will throw a . If you are using a connection-oriented protocol, you must either use to establish a remote host connection, or use to accept an incoming connection.

  If you are using a connectionless protocol and plan to send data to several different hosts, you should use the method. If you do not use the method, you will have to call before each call to . You can use even after you have established a default remote host with . You can also change the default remote host prior to calling by making another call to .

  If you are using a connection-oriented protocol, will block until all of the bytes in the buffer are sent, unless a time-out was set by using . If the time-out value was exceeded, the call will throw a . In non-blocking mode, may complete successfully even if it sends less than the number of bytes in the buffer. It is your application's responsibility to keep track of the number of bytes sent and to retry the operation until the application sends the bytes in the buffer. There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  The successful completion of a send does not indicate that the data was successfully delivered. If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in nonblocking mode.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sends the set of buffers in the list to a connected , using the specified .

  The number of bytes sent to the .

  A list of s of type that contains the data to be sent. A bitwise combination of the values.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` To be added. To be added. is .

  < 0.

  -or-

  > .Length.

  An asynchronous call is pending and a blocking method has been called.

  is not a valid combination of values.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  synchronously sends data to the remote host established in the or method and returns the number of bytes successfully sent. can be used for both connection-oriented and connectionless protocols.

  This overload requires a buffer that contains the data you want to send, the number of bytes you want to send, and a bitwise combination of any . If you specify the flag as the parameter, the data you are sending will not be routed.

  If you are using a connectionless protocol, you must call before calling this method, or will throw a . If you are using a connection-oriented protocol, you must either use to establish a remote host connection, or use to accept an incoming connection.

  If you are using a connectionless protocol and plan to send data to several different hosts, you should use the method. If you do not use the method, you will have to call the method before each call to the method. You can use even after you have established a default remote host with . You can also change the default remote host prior to calling by making another call to .

  With a connection-oriented protocol, will block until the requested number of bytes are sent, unless a time-out was set by using . If the time-out value was exceeded, the call will throw a . In nonblocking mode, may complete successfully even if it sends less than the number of bytes you request. It is your application's responsibility to keep track of the number of bytes sent and to retry the operation until the application sends the requested number of bytes. There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  You must ensure that the size does not exceed the maximum packet size of the underlying service provider. If it does, the datagram will not be sent and will throw a . If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  The successful completion of a send does not indicate that the data was successfully delivered. If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in nonblocking mode.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sends the specified number of bytes of data to a connected , using the specified .

  The number of bytes sent to the .

  The number of bytes to send. 0
- Method
  2.0.0.0
  4.0.0.0
  System.CLSCompliant(false)
  System.Int32 `` `` `` To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` `` To be added. To be added. is .

  < 0.

  -or-

  > .Length.

  -or-

  < 0.

  -or-

  > .Length - .

  An asynchronous call is pending and a blocking method has been called.

  is not a valid combination of values.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  synchronously sends data to the remote host specified in the or method and returns the number of bytes successfully sent. can be used for both connection-oriented and connectionless protocols.

  In this overload, if you specify the flag as the parameter, the data you are sending will not be routed.

  If you are using a connectionless protocol, you must call before calling this method or will throw a . If you are using a connection-oriented protocol, you must either use to establish a remote host connection, or use to accept an incoming connection.

  If you are using a connectionless protocol and plan to send data to several different hosts, you should use . If you do not use , you will have to call before each call to . It is okay to use even after you have established a default remote host with . You can also change the default remote host prior to calling by making another call to .

  You must also be sure that the size does not exceed the maximum packet size of the underlying service provider. If it does, the datagram will not be sent and will throw a .

  If you are using a connection-oriented protocol, will block until the requested number of bytes are sent, unless a time-out was set by using . If the time-out value was exceeded, the call will throw a . In nonblocking mode, may complete successfully even if it sends less than the number of bytes you request. It is your application's responsibility to keep track of the number of bytes sent and to retry the operation until the application sends the requested number of bytes. There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  The successful completion of a send does not indicate that the data was successfully delivered. If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in nonblocking mode.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sends the specified number of bytes of data to a connected , starting at the specified offset, and using the specified .

  The number of bytes sent to the .

  The position in the data buffer at which to begin sending data. The number of bytes to send. 0
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  The method is used to write outgoing data from one or more buffers on a connection-oriented socket. This method can also be used, however, on connectionless sockets that have specified a remote host on a connect operation.

  The method starts an asynchronous send operation to the remote host established in the , , , , , or method.

  The following properties and events on the object are required to successfully call this method:

  or

  if is set

  if is set

  The caller may set the property to any user state object desired before calling the method, so that the information will be retrievable in the callback method. If the callback needs more information than a single object, a small class can be created to hold the other required state information as members.

  The method will throw an exception if you do not first call , , , , or .

  Calling the method gives you the ability to send data within a separate execution thread.

  For message-oriented sockets, do not exceed the maximum message size of the underlying Windows sockets service provider. If the data is too long to pass atomically through the underlying service provider, no data is transmitted and the method throws a with the set to the native Winsock WSAEMSGSIZE error code (10040).

  Note that the successful completion of the method does not indicate that the data was successfully delivered.

  Sends data asynchronously to a connected object.

  Returns true if the I/O operation is pending. The event on the parameter will be raised upon completion of the operation.

  Returns false if the I/O operation completed synchronously. In this case, The event on the parameter will not be raised and the object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.

  The object to use for this asynchronous socket operation.
- Property
  2.0.0.0
  4.0.0.0
  System.Int32 To be added.

  A larger buffer size might delay the recognition of connection difficulties. Consider increasing the buffer size if you are transferring large files, or you are using a high bandwidth, high latency connection (such as a satellite broadband provider.)

  Gets or sets a value that specifies the size of the send buffer of the .

- Method
  2.0.0.0
  4.0.0.0
  System.Void ``

  This overload sends the file to the connected socket. The parameter defaults to (0), and the and parameters default to null. If is in the local directory, it may be identified with just the name of the file; otherwise, the full path and name of the file must be specified. Wildcards ("..\\myfile.txt") and UNC share names ("\\\\shared directory\\myfile.txt") are supported. If the file is not found, the exception is thrown.

  This method uses the TransmitFile function found in the Windows Sockets 2 API. For more information about the TransmitFile function and its flags, see the Windows Sockets documentation in the MSDN Library.

  synchronously sends a file to the remote host specified in the or method. can be used for both connection-oriented and for connectionless protocols.

  If you are using a connectionless protocol, you must call before calling this method, otherwise throws a exception. If you are using a connection-oriented protocol, you must either use to establish a remote host connection or use to accept an incoming connection.

  If you are using a connection-oriented protocol, blocks until the file is sent. In nonblocking mode, may complete successfully before the entire file has been sent. There is no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sends the file to a connected object with the transmit flag.

  A that contains the path and name of the file to be sent. This parameter can be null.
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` ``

  This overload requires the name of the file you want to send and a bitwise combination of values. The parameter contains any data you want to precede the file. contains data you want to follow the file. If is in the current working directory, it may be identified with just the name of the file; otherwise, the full path and name of the file must be specified. Wildcards ("..\\myfile.txt") and UNC share names ("\\\\shared directory\\myfile.txt") are supported.

  The parameter provides the Window Sockets service provider with additional information about the file transfer. For more information about how to use this parameter, see .

  This method uses the TransmitFile function found in the Windows Sockets 2 API. For more information about the TransmitFile function and its flags, see the Windows Sockets documentation in the MSDN Library.

  synchronously sends a file to the remote host specified in the or method. can be used for both connection-oriented and for connectionless protocols.

  If you are using a connectionless protocol, you must call before calling this method; otherwise throws a . If you are using a connection-oriented protocol, you must either use to establish a remote host connection, or use to accept an incoming connection.

  If you are using a connection-oriented protocol, blocks until the entire file is sent. In nonblocking mode, may complete successfully before the entire file has been sent. There is no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sends the file and buffers of data to a connected object using the specified value.

  A that contains the path and name of the file to be sent. This parameter can be null. A array that contains data to be sent before the file is sent. This parameter can be null. A array that contains data to be sent after the file is sent. This parameter can be null. One or more of values.
- Method
  2.0.0.0
  4.0.0.0
  System.MonoTODO("Not implemented")
  System.Boolean ``

  The method is used to send a collection of files or in memory data buffers to remote host. The must already be connected to the remote host.

  If a references a file in the working directory, it may be identified with just the name of the file; otherwise, the full path and name of the file must be specified. Wildcards and UNC share names are supported. If the file is not found, is thrown.

  To be notified of completion, you must create a callback method that implements the EventHandler<SocketAsyncEventArgs> delegate and attach the callback to the event.

  The property on the parameter provides the Window Sockets service provider with additional information about the file transfer. For more information about how to use this parameter, see .

  The following properties and events on the object are required to successfully call this method:

  The caller may set the property to any user state object desired before calling the method, so that the information will be retrievable in the callback method. If the callback needs more information than a single object, a small class can be created to hold the other required state information as members.

  This method uses the TransmitPackets function found in the Windows Sockets 2 API. For more information about the TransmitPackets function and its flags, see the Windows Sockets documentation in the MSDN Library.

  Although intended for connection-oriented protocols, the method also works for connectionless protocols, provided that you first call the , , or method to establish a default remote host. With connectionless protocols, you must also be sure that the size of your file does not exceed the maximum packet size of the underlying service provider. If it does, the datagram is not sent and throws a exception.

  The method is optimized according to the operating system on which it is used. On Windows server editions, the method is optimized for high performance.

  On Windows client editions, the method is optimized for minimum memory and resource utilization.

  Use of the flag in the property on the parameter can deliver significant performance benefits. If the thread initiating the method call is being used for heavy computations, it is possible, though unlikely, that APCs could be prevented from launching. Note that there is a difference between kernel and user-mode APCs. Kernel APCs launch when a thread is in a wait state. User-mode APCs launch when a thread is in an alertable wait state

  Sends a collection of files or in memory data buffers asynchronously to a connected object.

  Returns true if the I/O operation is pending. The event on the parameter will be raised upon completion of the operation.

  Returns false if the I/O operation completed synchronously. In this case, The event on the parameter will not be raised and the object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.

  The object to use for this asynchronous socket operation.
- Property
  2.0.0.0
  4.0.0.0
  System.Int32 To be added.

  This option applies to synchronous calls only. If the time-out period is exceeded, the method will throw a .

  Gets or sets a value that specifies the amount of time after which a synchronous call will time out.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` To be added.

  is .

  An asynchronous call is pending and a blocking method has been called.

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  A caller in the call stack does not have the required permissions. The current instance has been disposed. Requires permission to make a connection to the endpoint defined by . See .

  In this overload, the buffer offset defaults to 0, the number of bytes to send defaults to the size of the parameter, and the value defaults to 0.

  If you are using a connectionless protocol, you do not need to establish a default remote host with the method prior to calling . You only need to do this if you intend to call the method. If you do call the method prior to calling , the parameter will override the specified default remote host for that send operation only. You are also not required to call the method, because the underlying service provider will assign the most appropriate local network address and port number. If you need to identify the assigned local network address and port number, you can use the property after the method successfully completes.

  Although intended for connectionless protocols, also works with connection-oriented protocols. If you are using a connection-oriented protocol, you must first establish a remote host connection by calling the method or accept an incoming connection request using the method. If you do not establish or accept a remote host connection, will throw a . You can also establish a default remote host for a connectionless protocol prior to calling the method. In either of these cases, will ignore the parameter and only send data to the connected or default remote host.

  Blocking sockets will block until the all of the bytes in the buffer are sent. Since a nonblocking completes immediately, it might not send all of the bytes in the . It is your application's responsibility to keep track of the number of bytes sent and to retry the operation until the application sends all of the bytes in the . There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  If you are using a connectionless protocol in blocking mode, will block until the datagram is sent. If you want to send data to a broadcast address, you must first call the method and set the socket option to . You must also be sure that the number of bytes sent does not exceed the maximum packet size of the underlying service provider. If it does, the datagram will not be sent and will throw a .

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sends data to the specified endpoint.

  The number of bytes sent.

  An array of type that contains the data to be sent. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` To be added. To be added.

  is .

  An asynchronous call is pending and a blocking method has been called.

  is not a valid combination of values.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  A caller in the call stack does not have the required permissions. The current instance has been disposed. Requires permission to make a connection to the endpoint defined by . See .

  In this overload, the buffer offset defaults to 0, and the number of bytes to send defaults to the size of the . If you specify the flag as the parameter, the data you are sending will not be routed.

  If you are using a connectionless protocol, you do not need to establish a default remote host with the method prior to calling . You only need to do this if you intend to call the method. If you do call the method prior to calling , the parameter will override the specified default remote host for that send operation only. You are also not required to call the method, because the underlying service provider will assign the most appropriate local network address and port number. If you need to identify the assigned local network address and port number, you can use the property after the method successfully completes.

  Although intended for connectionless protocols, also works with connection-oriented protocols. If you are using a connection-oriented protocol, you must first establish a remote host connection by calling the method or accept an incoming connection request using the method. If you do not establish or accept a remote host connection, will throw a . You can also establish a default remote host for a connectionless protocol prior to calling the method. In either of these cases, will ignore the parameter and only send data to the connected or default remote host.

  Blocking sockets will block until the requested all of the bytes in the are sent. Since a nonblocking completes immediately, it might not send all of the bytes in the . It is your application's responsibility to keep track of the number of bytes sent and to retry the operation until the application sends all of the bytes in the . There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of out-going data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  If you are using a connectionless protocol in blocking mode, will block until the datagram is sent. If you want to send data to a broadcast address, you must first call the method and set the socket option to . You must also be sure that the number of bytes sent does not exceed the maximum packet size of the underlying service provider. If it does, the datagram will not be sent and will throw a .

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sends data to a specific endpoint using the specified .

  The number of bytes sent.

  An array of type that contains the data to be sent. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` `` To be added. To be added.

  is .

  < 0.

  -or-

  > .Length.

  An asynchronous call is pending and a blocking method has been called.

  is not a valid combination of values.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  A caller in the call stack does not have the required permissions. The current instance has been disposed. Requires permission to make a connection to the endpoint defined by . See .

  In this overload, the buffer offset defaults to 0. If you specify the flag as the parameter, the data you are sending will not be routed.

  If you are using a connectionless protocol, you do not need to establish a default remote host with the method prior to calling . You only need to do this if you intend to call the method. If you do call the method prior to calling , the parameter will override the specified default remote host for that send operation only. You are also not required to call the method, because the underlying service provider will assign the most appropriate local network address and port number. If you need to identify the assigned local network address and port number, you can use the property after the method successfully completes.

  Although intended for connectionless protocols, also works with connection-oriented protocols. If you are using a connection-oriented protocol, you must first establish a remote host connection by calling the method or accept an incoming connection request using the method. If you do not establish or accept a remote host connection, will throw a . You can also establish a default remote host for a connectionless protocol prior to calling the method. In either of these cases, will ignore the parameter and only send data to the connected or default remote host.

  Blocking sockets will block until the requested number of bytes are sent. Since a nonblocking completes immediately, it might not send all of the bytes requested in a single operation. It is your application's responsibility to keep track of the number of bytes sent and to retry the operation until the application sends the requested number of bytes. There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of out-going data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  If you are using a connectionless protocol in blocking mode, will block until the datagram is sent. If you want to send data to a broadcast address, you must first call the method and set the socket option to . You must also be sure that the number of bytes sent does not exceed the maximum packet size of the underlying service provider. If it does, the datagram will not be sent and will throw a .

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sends the specified number of bytes of data to the specified endpoint using the specified .

  The number of bytes sent.

  An array of type that contains the data to be sent. The number of bytes to send. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` `` `` To be added. To be added.

  is .

  < 0.

  -or-

  > .Length.

  -or-

  < 0.

  -or-

  > .Length - .

  An asynchronous call is pending and a blocking method has been called.

  is not a valid combination of values.

  -or-

  An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  A caller in the call stack does not have the required permissions. The current instance has been disposed. Requires permission to make a connection to the endpoint defined by . See .

  In this overload, if you specify the flag as the parameter, the data you are sending will not be routed.

  If you are using a connectionless protocol, you do not need to establish a default remote host with the method prior to calling . You only need to do this if you intend to call the method. If you do call the method prior to calling , the parameter will override the specified default remote host for that send operation only. You are also not required to call the method, because the underlying service provider will assign the most appropriate local network address and port number. If you need to identify the assigned local network address and port number, you can use the property after the method successfully completes.

  Although intended for connectionless protocols, also works with connection-oriented protocols. If you are using a connection-oriented protocol, you must first establish a remote host connection by calling the method or accept an incoming connection request using the method. If you do not establish or accept a remote host connection, will throw a . You can also establish a default remote host for a connectionless protocol prior to calling the method. In either of these cases, will ignore the parameter and only send data to the connected or default remote host.

  Blocking sockets will block until the requested number of bytes are sent. Since a non-blocking completes immediately, it might not send all of the bytes requested in a single operation. It is your applications responsibility to keep track of the number of bytes sent and to retry the operation until the application sends the requested number of bytes. There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of out-going data is collected. A successful completion of the method means that the underlying system has had room to buffer your data for a network send.

  If you are using a connectionless protocol in blocking mode, will block until the datagram is sent. If you want to send data to a broadcast address, you must first call the method and set the socket option to . You must also be sure that the size does not exceed the maximum packet size of the underlying service provider. If it does, the datagram will not be sent and will throw a .

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sends the specified number of bytes of data to the specified endpoint, starting at the specified location in the buffer, and using the specified .

  The number of bytes sent.

  An array of type that contains the data to be sent. The position in the data buffer at which to begin sending data. The number of bytes to send. 0
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  The method starts an asynchronous send operation to the remote host specified in the property of the parameter. Calling the method gives you the ability to send data within a separate execution thread. Although this method is intended for connectionless protocols, works with both connectionless and connection-oriented protocols.

  To be notified of completion, you must create a callback method that implements the EventHandler<SocketAsyncEventArgs> delegate and attach the callback to the event.

  The following properties and events on the object are required to successfully call this method:

  The caller may set the property to any user state object desired before calling the method, so that the information will be retrievable in the callback method. If the callback needs more information than a single object, a small class can be created to hold the other required state information as members.

  If you are using a connection-oriented protocol, you must first call the , , , , , or method. Otherwise will throw a . When using a connection-oriented protocol, the method will ignore the property and send data to the established in the , , , , , or method.

  If you are using a connectionless protocol, you do not need to establish a default remote host with the , , or method prior to calling . You only need to do this if you intend to call the or methods. If you do call the , , or method prior to calling , the property will override the specified default remote host for that send operation only. You are also not required to call the method. In this case, the underlying service provider will assign the most appropriate local network IP address and port number. Use a port number of zero if you want the underlying service provider to select a free port. If you need to identify the assigned local network IP address and port number, you can use the property after the event is signaled and the associated delegates are called.

  If you want to send data to a broadcast address, you must first call the method and set the socket option for to true. You must also be sure that the size of your buffer does not exceed the maximum packet size of the underlying service provider. If it does, the datagram will not be sent and will throw a .

  If you specify the DontRoute flag in the property, the data you are sending will not be routed.

  For message-oriented sockets, care must be taken not to exceed the maximum message size of the underlying transport. If the size of the buffer exceeds the maximum packet size of the underlying service provider, the datagram is not sent and will throw a . The successful completion of a method does not indicate that the data was successfully delivered.

  Sends data asynchronously to a specific remote host.

  Returns true if the I/O operation is pending. The event on the parameter will be raised upon completion of the operation.

  Returns false if the I/O operation completed synchronously. In this case, The event on the parameter will not be raised and the object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.

  The object to use for this asynchronous socket operation.
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` `` ``

  options determine the behavior of the current . Set to true to enable the option, or to false to disable the option.

  options are grouped by level of protocol support.

  Listed below are the various options that can be set using this overload. These options are grouped by the appropriate value. If you intend to set any of these options, be sure to use the appropriate value for the parameter. The option you choose to set must be specified in the parameter. If you want to get the current value of any of the options listed, use the method.

  options that can be set using this overload.

  options that can be set using this overload.

  options that can be set using this overload.

  options that can be set using this overload.

  For more information on these options, refer to the enumeration.

  If you receive a exception, use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  Sets the specified option to the specified value.

  One of the values. One of the values. The value of the option, represented as a .
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  A caller in the call stack does not have the required permissions. The current instance has been disposed. Requires permission to access unmanaged code. See .

  options determine the behavior of the current . Use this overload to set those options that require a byte array as an option value.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sets the specified option to the specified value, represented as a byte array.

  One of the values. One of the values. An array of type that represents the value of the option. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  A caller in the call stack does not have the required permissions. The current instance has been disposed. Some options require permission to access unmanaged code. All the options that do not require permission are noted in the tables in the Description section. All options not so noted require this permission. See .

  options determine the behavior of the current . For an option with a data type, specify a nonzero value to enable the option, and a zero value to disable the option. For an option with an integer data type, specify the appropriate value. options are grouped by level of protocol support.

  Listed below are the various options that can be set using this overload. These options are grouped by the appropriate . If you intend to set any of these options, be sure to use the appropriate for the parameter. The option you choose to set must be specified in the parameter. If you want to get the current value of any of the options listed, use the method.

  options that can be set using this overload.

  options that can be set using this overload.

  options that can be set using this overload.

  options that can be set using this overload.

  options that can be set using this overload.

  For more information about these options, refer to the enumeration.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Sets the specified option to the specified integer value.

  One of the values. One of the values. A value of the option. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` , , or specified an invalid value. is . An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  A caller in the call stack does not have the required permissions. The current instance has been disposed. The and options require permission to access unmanaged code. See .

  options determine the behavior of the current . Use this overload to set the , , and options. For the option, use for the parameter. For and , use . If you want to get the current value of any of the options listed above, use the method.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  Sets the specified option to the specified value, represented as an object.

  One of the values. One of the values. A or that contains the value of the option. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` An error occurred while accessing the socket.

  For additional information on causes of the , see the class.

  The current instance has been disposed.

  When using a connection-oriented , always call the method before closing the . This ensures that all data is sent and received on the connected socket before it is closed.

  Call the method to free all managed and unmanaged resources associated with the . Do not attempt to reuse the after closing.

  The following table shows the enumeration values that are valid for the parameter.

  Value

  Description

  Send

  Disable sending on this .

  Receive

  Disable receiving on this .

  Both

  Disable both sending and receiving on this .

  Setting to specifies that subsequent calls to are not allowed. If you are using a connectionless , specifying will have no effect.

  Setting to specifies that subsequent calls to are not allowed. This has no effect on lower protocol layers. If you are using a connection-oriented protocol, the connection is terminated if either of the following conditions exist after a call to :

  Data is in the incoming network buffer waiting to be received.

  More data has arrived.

  If you are using a connectionless protocol, datagrams are accepted and queued. However, if no buffer space is available for additional incoming datagrams, they will be discarded and no error will be returned to the sender. Using on a connectionless is not recommended.

  Setting to disables both sends and receives as described above.

  If you receive a when calling the method, use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

  Disables sends and receives on a .

  One of the values that specifies the operation that will no longer be allowed. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Net.Sockets.SocketType

  One of the values defined in the enumeration.

  is read-only and is set when the is created.

  Gets the type of the .

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  The operating system may support both IPv4 and IPv6 protocols.

  Gets a value indicating whether IPv4 support is available and enabled on the current host.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Obsolete("Use OSSupportsIPv6 instead")
  System.Boolean To be added.

  The operating system may support both IPv4 and IPv6 protocols.

  Gets a value that indicates whether the Framework supports IPv6 for certain obsolete members.

- Method
  System.Void

  Call when you are finished using the . The method leaves the in an unusable state. After calling , you must release all references to the so the garbage collector can reclaim the memory that the was occupying. For more information, see [<topic://cpconCleaningUpUnmanagedResources>] and [<topic://cpconImplementingDisposeMethod>].

  Note: Always call before you release your last reference to the . Otherwise, the resources it is using will not be freed until the garbage collector calls the object's Finalize method.

  Releases all resources used by the .

  0
  1.0.5000.0
  2.0.0.0
- Property
  2.0.0.0
  4.0.0.0
  System.Int16 To be added.

  The TTL value indicates the maximum number of routers the packet can traverse before the router discards the packet and an Internet Control Message Protocol (ICMP) "TTL exceeded" error message is returned to the sender.

  The TTL value may be set to a value from 0 to 255. When this property is not set, the default TTL value for a socket is 32.

  Setting this property on a Transmission Control Protocol (TCP) socket is ignored by the TCP/IP stack if a successful connection has been established using the socket.

  If you receive a , use the property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

  Gets or sets a value that specifies the Time To Live (TTL) value of Internet Protocol (IP) packets sent by the .

- Property
  2.0.0.0
  4.0.0.0
  System.MonoTODO("This doesn't do anything on Mono yet")
  System.Boolean To be added.

  Set this property to true for a you intend to call . Otherwise, the Framework may assign a completion port to the socket, which would prohibit the use of .

  Specifies whether the socket should only use Overlapped I/O mode.

0