Share via


<socket> Element (Network Settings)

Specifies whether socket operations use completion ports.

<socket
  alwaysUseCompletionPortsForConnect="true|false"
  alwaysUseCompletionPortsForAccept="true|false"
/>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

alwaysUseCompletionPortsForAccept

Indicates whether the socket should always use completion ports for Accept method calls.

alwaysUseCompletionPortsForConnect

Indicates whether the socket should always use completion ports for Connect method calls.

Child Elements

None.

Parent Elements

Element Description

settings

Configures basic network options for the System.Net namespace.

Remarks

Completion ports are supported on Windows NT version 3.5 and later Windows operating systems. Completion ports are recommended for high performance server applications.

Configuration Files

This element can be used in the application configuration file or the machine configuration file (Machine.config).

Example

The following code example shows how to specify that completion ports should be used.

<configuration>
  <system.net>
    <settings>
      <socket
        alwaysUseCompletionPortsForAccept="true"
        alwaysUseCompletionPortsForConnect="true"
       />
    </settings>
  </system.net>
</configuration>

See Also

Reference

Network Settings Schema
System.Net
System.Net.Sockets