StreamSocketControl.SerializeConnectionAttempts Property

Definition

A value that indicates whether, when multiple connection attempts are being made, the attempts are made in parallel or serially.

public:
 property bool SerializeConnectionAttempts { bool get(); void set(bool value); };
bool SerializeConnectionAttempts();

void SerializeConnectionAttempts(bool value);
public bool SerializeConnectionAttempts { get; set; }
var boolean = streamSocketControl.serializeConnectionAttempts;
streamSocketControl.serializeConnectionAttempts = boolean;
Public Property SerializeConnectionAttempts As Boolean

Property Value

Boolean

bool

When true, at most one connection attempt will be active at one time on this StreamSocket. Default value is false.

Remarks

In certain circumstances, the Windows runtime might attempt to establish a connection using multiple methods in parallel. For example, when StreamSocket attempts a connection and a proxy is detected on the network, it attempts both a direct connection to the specified IP address, and an HTTP CONNECT request (which will connect via the proxy) in parallel. The first connection to succeed is the one that is used by the StreamSocket object. While this works well in most cases, it causes problems with some servers in the case where both connection attempts succeed. If your app is using StreamSocket to connect to a server where the parallel connection method causes problems on the server, you should set SerializeConnectionAttempts to true before connecting. This will ensure that at most one TCP connection attempt is ongoing at any given time, and that only a single connection is used.

Your code must set this property before you call ConnectAsync to attempt to connect. Changing this property value after ConnectAsync has been called results in an exception being thrown.

Note that serializing the connection logic can make establishing the connection take longer.

Applies to